void NotifyQt::notifyListPreChange(int list, int type) { #ifdef NOTIFY_DEBUG std::cerr << "NotifyQt::notifyListPreChange()" << std::endl; #endif switch(list) { case NOTIFY_LIST_NEIGHBOURS: break; case NOTIFY_LIST_FRIENDS: emit friendsChanged() ; break; case NOTIFY_LIST_DIRLIST_FRIENDS: emit filesPreModChanged(false) ; /* remote */ break ; case NOTIFY_LIST_DIRLIST_LOCAL: emit filesPreModChanged(true) ; /* local */ break; case NOTIFY_LIST_SEARCHLIST: break; case NOTIFY_LIST_MESSAGELIST: break; case NOTIFY_LIST_CHANNELLIST: break; case NOTIFY_LIST_TRANSFERLIST: break; default: break; } return; }
void LLFloaterWorldMap::observeFriends() { if(!mFriendObserver) { mFriendObserver = new LLMapFriendObserver; LLAvatarTracker::instance().addObserver(mFriendObserver); friendsChanged(); } }
/** Constructor */ SecurityItem::SecurityItem(FeedHolder *parent, uint32_t feedId, std::string gpgId, std::string sslId, uint32_t type, bool isHome) :QWidget(NULL), mParent(parent), mFeedId(feedId), mSslId(sslId), mGpgId(gpgId), mType(type), mIsHome(isHome) { /* Invoke the Qt Designer generated object setup routine */ setupUi(this); messageframe->setVisible(false); sendmsgButton->setEnabled(false); quickmsgButton->setEnabled(false); chatButton->setEnabled(false); addFriendButton->setEnabled(false); removeFriendButton->setEnabled(false); removeFriendButton->hide(); peerDetailsButton->setEnabled(false); /* general ones */ connect( expandButton, SIGNAL( clicked( void ) ), this, SLOT( toggle ( void ) ) ); connect( clearButton, SIGNAL( clicked( void ) ), this, SLOT( removeItem ( void ) ) ); /* specific ones */ connect( chatButton, SIGNAL( clicked( void ) ), this, SLOT( openChat ( void ) ) ); connect( actionNew_Message, SIGNAL( triggered( ) ), this, SLOT( sendMsg ( void ) ) ); connect( quickmsgButton, SIGNAL( clicked( ) ), this, SLOT( togglequickmessage() ) ); connect( cancelButton, SIGNAL( clicked( ) ), this, SLOT( togglequickmessage() ) ); connect( sendmsgButton, SIGNAL( clicked( ) ), this, SLOT( sendMessage() ) ); connect(addFriendButton, SIGNAL(clicked()), this, SLOT(addFriend())); connect(removeFriendButton, SIGNAL(clicked()), this, SLOT(removeFriend())); connect(peerDetailsButton, SIGNAL(clicked()), this, SLOT(peerDetails())); connect(NotifyQt::getInstance(), SIGNAL(friendsChanged()), this, SLOT(updateItem())); QMenu *msgmenu = new QMenu(); msgmenu->addAction(actionNew_Message); quickmsgButton->setMenu(msgmenu); avatar->setId(mSslId, false); small(); updateItemStatic(); updateItem(); }
/** Constructor */ SecurityItem::SecurityItem(FeedHolder *parent, uint32_t feedId, const RsPgpId &gpgId, const RsPeerId &sslId, const std::string &sslCn, const std::string& ip_address,uint32_t type, bool isHome) : FeedItem(NULL), mParent(parent), mFeedId(feedId), mGpgId(gpgId), mSslId(sslId), mSslCn(sslCn), mIP(ip_address), mType(type), mIsHome(isHome) { /* Invoke the Qt Designer generated object setup routine */ setupUi(this); //quickmsgButton->hide(); chatButton->hide(); removeFriendButton->setEnabled(false); removeFriendButton->hide(); peerDetailsButton->setEnabled(false); friendRequesttoolButton->hide(); requestLabel->hide(); /* general ones */ connect( expandButton, SIGNAL( clicked( void ) ), this, SLOT( toggle ( void ) ) ); connect( clearButton, SIGNAL( clicked( void ) ), this, SLOT( removeItem ( void ) ) ); /* specific ones */ connect( chatButton, SIGNAL( clicked( void ) ), this, SLOT( openChat ( void ) ) ); //connect( quickmsgButton, SIGNAL( clicked( ) ), this, SLOT( sendMsg() ) ); connect( removeFriendButton, SIGNAL(clicked()), this, SLOT(removeFriend())); connect( peerDetailsButton, SIGNAL(clicked()), this, SLOT(peerDetails())); connect( friendRequesttoolButton, SIGNAL(clicked()), this, SLOT(friendRequest())); connect(NotifyQt::getInstance(), SIGNAL(friendsChanged()), this, SLOT(updateItem())); avatar->setId(ChatId(mSslId)); expandFrame->hide(); updateItemStatic(); updateItem(); }
void NotifyQt::notifyListChange(int list, int type) { #ifdef NOTIFY_DEBUG std::cerr << "NotifyQt::notifyListChange()" << std::endl; #endif switch(list) { case NOTIFY_LIST_NEIGHBOURS: #ifdef NOTIFY_DEBUG std::cerr << "received neighbrs changed" << std::endl ; #endif emit neighborsChanged(); break; case NOTIFY_LIST_FRIENDS: #ifdef NOTIFY_DEBUG std::cerr << "received friends changed" << std::endl ; #endif emit friendsChanged() ; break; case NOTIFY_LIST_DIRLIST_LOCAL: #ifdef NOTIFY_DEBUG std::cerr << "received files changed" << std::endl ; #endif emit filesPostModChanged(true) ; /* Local */ break; case NOTIFY_LIST_DIRLIST_FRIENDS: #ifdef NOTIFY_DEBUG std::cerr << "received files changed" << std::endl ; #endif emit filesPostModChanged(false) ; /* Local */ break; case NOTIFY_LIST_SEARCHLIST: break; case NOTIFY_LIST_MESSAGELIST: #ifdef NOTIFY_DEBUG std::cerr << "received msg changed" << std::endl ; #endif emit messagesChanged() ; break; case NOTIFY_LIST_MESSAGE_TAGS: #ifdef NOTIFY_DEBUG std::cerr << "received msg tags changed" << std::endl ; #endif emit messagesTagsChanged(); break; case NOTIFY_LIST_CHANNELLIST: break; case NOTIFY_LIST_TRANSFERLIST: #ifdef NOTIFY_DEBUG std::cerr << "received transfer changed" << std::endl ; #endif emit transfersChanged() ; break; case NOTIFY_LIST_CONFIG: #ifdef NOTIFY_DEBUG std::cerr << "received config changed" << std::endl ; #endif emit configChanged() ; break ; case NOTIFY_LIST_FORUMLIST_LOCKED: #ifdef NOTIFY_DEBUG std::cerr << "received forum msg changed" << std::endl ; #endif emit forumsChanged(); // use connect with Qt::QueuedConnection break; case NOTIFY_LIST_CHANNELLIST_LOCKED: #ifdef NOTIFY_DEBUG std::cerr << "received channel msg changed" << std::endl ; #endif emit channelsChanged(type); // use connect with Qt::QueuedConnection break; case NOTIFY_LIST_PUBLIC_CHAT: #ifdef NOTIFY_DEBUG std::cerr << "received public chat changed" << std::endl ; #endif emit publicChatChanged(type); break; case NOTIFY_LIST_PRIVATE_INCOMING_CHAT: case NOTIFY_LIST_PRIVATE_OUTGOING_CHAT: #ifdef NOTIFY_DEBUG std::cerr << "received private chat changed" << std::endl ; #endif emit privateChatChanged(list, type); break; case NOTIFY_LIST_GROUPLIST: #ifdef NOTIFY_DEBUG std::cerr << "received groups changed" << std::endl ; #endif emit groupsChanged(type); break; default: break; } return; }
void QFacebookGraphConnectionFriends::setFriends(const QVariantList &friends) { if(m_friends != friends) { m_friends = friends; emit friendsChanged(); } }
/** Constructor */ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags flags) : RWindow("MainWindow", parent, flags) { ui = new Ui::MainWindow; trayIcon = NULL; /* Invoke the Qt Designer generated QObject setup routine */ ui->setupUi(this); _instance = this; m_bStatusLoadDone = false; isIdle = false; onlineCount = 0; notifyMenu = NULL; /* Calculate only once */ RsPeerDetails pd; if (rsPeers->getPeerDetails(rsPeers->getOwnId(), pd)) { nameAndLocation = QString("%1 (%2)").arg(QString::fromUtf8(pd.name.c_str())).arg(QString::fromUtf8(pd.location.c_str())); } setWindowTitle(tr("RetroShare %1 a secure decentralized communication platform").arg(Rshare::retroshareVersion(false)) + " - " + nameAndLocation); /* add url handler for RetroShare links */ QDesktopServices::setUrlHandler(RSLINK_SCHEME, this, "retroshareLinkActivated"); QDesktopServices::setUrlHandler("http", this, "externalLinkActivated"); QDesktopServices::setUrlHandler("https", this, "externalLinkActivated"); // Setting icons this->setWindowIcon(QIcon(QString::fromUtf8(":/icons/logo_128.png"))); /* Create all the dialogs of which we only want one instance */ _bandwidthGraph = new BandwidthGraph(); #ifdef UNFINISHED applicationWindow = new ApplicationWindow(); applicationWindow->hide(); #endif initStackedPage(); connect(ui->listWidget, SIGNAL(currentRowChanged(int)), this, SLOT(setNewPage(int))); connect(ui->stackPages, SIGNAL(currentChanged(int)), this, SLOT(setNewPage(int))); //ui->stackPages->setCurrentIndex(Settings->getLastPageInMainWindow()); setNewPage(Settings->getLastPageInMainWindow()); ui->splitter->setStretchFactor(0, 0); ui->splitter->setStretchFactor(1, 1); /* Load listWidget postion */ QByteArray state = Settings->valueFromGroup("MainWindow", "SplitterState", QByteArray()).toByteArray(); if (!state.isEmpty()) ui->splitter->restoreState(state); state = Settings->valueFromGroup("MainWindow", "State", QByteArray()).toByteArray(); if (!state.isEmpty()) restoreState(state); /** StatusBar section ********/ /* initialize combobox in status bar */ statusComboBox = new QComboBox(statusBar()); statusComboBox->setFocusPolicy(Qt::ClickFocus); initializeStatusObject(statusComboBox, true); QWidget *widget = new QWidget(); QHBoxLayout *hbox = new QHBoxLayout(); hbox->setMargin(0); hbox->setSpacing(6); hbox->addWidget(statusComboBox); widget->setLayout(hbox); statusBar()->addWidget(widget); peerstatus = new PeerStatus(); statusBar()->addWidget(peerstatus); natstatus = new NATStatus(); statusBar()->addWidget(natstatus); dhtstatus = new DHTStatus(); statusBar()->addWidget(dhtstatus); hashingstatus = new HashingStatus(); statusBar()->addPermanentWidget(hashingstatus, 1); discstatus = new DiscStatus(); statusBar()->addPermanentWidget(discstatus); ratesstatus = new RatesStatus(); statusBar()->addPermanentWidget(ratesstatus); opModeStatus = new OpModeStatus(); statusBar()->addPermanentWidget(opModeStatus); soundStatus = new SoundStatus(); soundStatus->setHidden(Settings->valueFromGroup("StatusBar", "HideSound", QVariant(false)).toBool()); statusBar()->addPermanentWidget(soundStatus); toasterDisable = new ToasterDisable(); toasterDisable->setHidden(Settings->valueFromGroup("StatusBar", "HideToaster", QVariant(false)).toBool()); statusBar()->addPermanentWidget(toasterDisable); sysTrayStatus = new SysTrayStatus(); sysTrayStatus->setVisible(Settings->valueFromGroup("StatusBar", "ShowSysTrayOnStatusBar", QVariant(false)).toBool()); statusBar()->addPermanentWidget(sysTrayStatus); setCompactStatusMode(Settings->valueFromGroup("StatusBar", "CompactMode", QVariant(false)).toBool()); /** Status Bar end ******/ /* Creates a tray icon with a context menu and adds it to the system's * notification area. */ createTrayIcon(); createNotifyIcons(); /* calculate friend count */ updateFriends(); connect(NotifyQt::getInstance(), SIGNAL(peerStatusChanged(QString,int)), this, SLOT(updateFriends())); connect(NotifyQt::getInstance(), SIGNAL(friendsChanged()), this, SLOT(updateFriends())); loadOwnStatus(); /* Set focus to the current page */ ui->stackPages->currentWidget()->setFocus(); idle = new Idle(); idle->start(); connect(idle, SIGNAL(secondsIdle(int)), this, SLOT(checkAndSetIdle(int))); QTimer *timer = new QTimer(this); timer->connect(timer, SIGNAL(timeout()), this, SLOT(updateStatus())); timer->start(1000); connect(NotifyQt::getInstance(), SIGNAL(settingsChanged()), this, SLOT(settingsChanged())); settingsChanged(); }
/** Constructor */ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags) : RWindow("MainWindow", parent, flags), ui(new Ui::MainWindow) { /* Invoke the Qt Designer generated QObject setup routine */ ui->setupUi(this); _instance = this; m_bStatusLoadDone = false; isIdle = false; onlineCount = 0; notifyMenu = NULL; /* Calculate only once */ RsPeerDetails pd; if (rsPeers->getPeerDetails(rsPeers->getOwnId(), pd)) { nameAndLocation = QString("%1 (%2)").arg(QString::fromUtf8(pd.name.c_str())).arg(QString::fromUtf8(pd.location.c_str())); } setWindowTitle(tr("RetroShare %1 a secure decentralized communication platform").arg(retroshareVersion()) + " - " + nameAndLocation); /* WORK OUT IF WE"RE IN ADVANCED MODE OR NOT */ bool advancedMode = false; std::string advsetting; if (rsConfig->getConfigurationOption(RS_CONFIG_ADVANCED, advsetting) && (advsetting == "YES")) { advancedMode = true; } /* add url handler for RetroShare links */ QDesktopServices::setUrlHandler(RSLINK_SCHEME, this, "retroshareLinkActivated"); QDesktopServices::setUrlHandler("http", this, "externalLinkActivated"); QDesktopServices::setUrlHandler("https", this, "externalLinkActivated"); // Setting icons this->setWindowIcon(QIcon(QString::fromUtf8(":/images/rstray3.png"))); /* Create all the dialogs of which we only want one instance */ _bandwidthGraph = new BandwidthGraph(); #ifdef UNFINISHED applicationWindow = new ApplicationWindow(); applicationWindow->hide(); #endif /** Left Side ToolBar**/ connect(ui->actionAdd_Friend, SIGNAL(triggered() ), this , SLOT( addFriend() ) ); connect(ui->actionAdd_Share, SIGNAL(triggered() ), this , SLOT( openShareManager() ) ); connect(ui->actionOptions, SIGNAL(triggered()), this, SLOT( showSettings()) ); connect(ui->actionMessenger, SIGNAL(triggered()), this, SLOT( showMessengerWindow()) ); ui->actionMessenger->setVisible(true); connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT( showabout()) ); //connect(ui->actionColor, SIGNAL(triggered()), this, SLOT( setStyle()) ); /** adjusted quit behaviour: trigger a warning that can be switched off in the saved config file RetroShare.conf */ connect(ui->actionQuit, SIGNAL(triggered()), this, SLOT(doQuit())); QList<QPair<MainPage*, QAction*> > notify; /* Create the Main pages and actions */ QActionGroup *grp = new QActionGroup(this); QAction *action; ui->stackPages->add(newsFeed = new NewsFeed(ui->stackPages), createPageAction(QIcon(IMAGE_NEWSFEED), tr("News feed"), grp)); // ui->stackPages->add(networkDialog = new NetworkDialog(ui->stackPages), // createPageAction(QIcon(IMAGE_NETWORK2), tr("Network"), grp)); ui->stackPages->add(friendsDialog = new FriendsDialog(ui->stackPages), action = createPageAction(QIcon(IMAGE_PEERS), tr("Friends"), grp)); notify.push_back(QPair<MainPage*, QAction*>(friendsDialog, action)); // ui->stackPages->add(searchDialog = new SearchDialog(ui->stackPages), // createPageAction(QIcon(IMAGE_SEARCH), tr("Search"), grp)); ui->stackPages->add(transfersDialog = new TransfersDialog(ui->stackPages), action = createPageAction(QIcon(IMAGE_TRANSFERS), tr("File sharing"), grp)); notify.push_back(QPair<MainPage*, QAction*>(transfersDialog, action)); ui->stackPages->add(chatLobbyDialog = new ChatLobbyWidget(ui->stackPages), action = createPageAction(QIcon(IMAGE_CHATLOBBY), tr("Chat Lobbies"), grp)); notify.push_back(QPair<MainPage*, QAction*>(chatLobbyDialog, action)); ui->stackPages->add(messagesDialog = new MessagesDialog(ui->stackPages), action = createPageAction(QIcon(IMAGE_MESSAGES), tr("Messages"), grp)); notify.push_back(QPair<MainPage*, QAction*>(messagesDialog, action)); ui->stackPages->add(channelFeed = new ChannelFeed(ui->stackPages), action = createPageAction(QIcon(IMAGE_CHANNELS), tr("Channels"), grp)); notify.push_back(QPair<MainPage*, QAction*>(channelFeed, action)); #ifdef BLOGS ui->stackPages->add(blogsFeed = new BlogsDialog(ui->stackPages), createPageAction(QIcon(IMAGE_BLOGS), tr("Blogs"), grp)); #endif ui->stackPages->add(forumsDialog = new ForumsDialog(ui->stackPages), action = createPageAction(QIcon(IMAGE_FORUMS), tr("Forums"), grp)); notify.push_back(QPair<MainPage*, QAction*>(forumsDialog, action)); std::cerr << "Looking for interfaces in existing plugins:" << std::endl; for(int i = 0;i<rsPlugins->nbPlugins();++i) { QIcon icon ; if(rsPlugins->plugin(i) != NULL && rsPlugins->plugin(i)->qt_page() != NULL) { if(rsPlugins->plugin(i)->qt_icon() != NULL) icon = *rsPlugins->plugin(i)->qt_icon() ; else icon = QIcon(":images/extension_48.png") ; std::cerr << " Addign widget page for plugin " << rsPlugins->plugin(i)->getPluginName() << std::endl; MainPage *pluginPage = rsPlugins->plugin(i)->qt_page(); QAction *pluginAction = createPageAction(icon, QString::fromUtf8(rsPlugins->plugin(i)->getPluginName().c_str()), grp); ui->stackPages->add(pluginPage, pluginAction); notify.push_back(QPair<MainPage*, QAction*>(pluginPage, pluginAction)); } else if(rsPlugins->plugin(i) == NULL) std::cerr << " No plugin object !" << std::endl; else std::cerr << " No plugin page !" << std::endl; } #ifndef RS_RELEASE_VERSION #ifdef PLUGINMGR ui->stackPages->add(pluginsPage = new PluginsPage(ui->stackPages), createPageAction(QIcon(IMAGE_PLUGINS), tr("Plugins"), grp)); #endif #endif #ifdef GETSTARTED_GUI MainPage *getStartedPage = NULL; if (!advancedMode) { ui->stackPages->add(getStartedPage = new GetStartedDialog(ui->stackPages), createPageAction(QIcon(IMG_HELP), tr("Getting Started"), grp)); } #endif /* Create the toolbar */ ui->toolBar->addActions(grp->actions()); connect(grp, SIGNAL(triggered(QAction *)), ui->stackPages, SLOT(showPage(QAction *))); #ifdef UNFINISHED ui->toolBar->addSeparator(); addAction(new QAction(QIcon(IMAGE_UNFINISHED), tr("Unfinished"), ui->toolBar), SLOT(showApplWindow())); #endif ui->stackPages->setCurrentIndex(Settings->getLastPageInMainWindow()); /** StatusBar section ********/ /* initialize combobox in status bar */ statusComboBox = new QComboBox(statusBar()); statusComboBox->setFocusPolicy(Qt::ClickFocus); initializeStatusObject(statusComboBox, true); QWidget *widget = new QWidget(); QHBoxLayout *hbox = new QHBoxLayout(); hbox->setMargin(0); hbox->setSpacing(6); hbox->addWidget(statusComboBox); widget->setLayout(hbox); statusBar()->addWidget(widget); peerstatus = new PeerStatus(); statusBar()->addWidget(peerstatus); natstatus = new NATStatus(); statusBar()->addWidget(natstatus); dhtstatus = new DHTStatus(); statusBar()->addWidget(dhtstatus); hashingstatus = new HashingStatus(); statusBar()->addPermanentWidget(hashingstatus); discstatus = new DiscStatus(); statusBar()->addPermanentWidget(discstatus); ratesstatus = new RatesStatus(); statusBar()->addPermanentWidget(ratesstatus); statusBar()->addPermanentWidget(new OpModeStatus()); statusBar()->addPermanentWidget(new SoundStatus()); /** Status Bar end ******/ /* Creates a tray icon with a context menu and adds it to the system's * notification area. */ createTrayIcon(); QList<QPair<MainPage*, QAction*> >::iterator notifyIt; for (notifyIt = notify.begin(); notifyIt != notify.end(); ++notifyIt) { UserNotify *userNotify = notifyIt->first->getUserNotify(this); if (userNotify) { userNotify->initialize(ui->toolBar, notifyIt->second); connect(userNotify, SIGNAL(countChanged()), this, SLOT(updateTrayCombine())); userNotifyList.push_back(userNotify); } } createNotifyIcons(); /* caclulate friend count */ updateFriends(); connect(NotifyQt::getInstance(), SIGNAL(peerStatusChanged(QString,int)), this, SLOT(updateFriends())); connect(NotifyQt::getInstance(), SIGNAL(friendsChanged()), this, SLOT(updateFriends())); loadOwnStatus(); /* Set focus to the current page */ ui->stackPages->currentWidget()->setFocus(); idle = new Idle(); idle->start(); connect(idle, SIGNAL(secondsIdle(int)), this, SLOT(checkAndSetIdle(int))); QTimer *timer = new QTimer(this); timer->connect(timer, SIGNAL(timeout()), this, SLOT(updateStatus())); timer->start(1000); }
int main(int argc, char *argv[]) { #ifdef WINDOWS_SYS { /* Set the current directory to the application dir, because the start dir with autostart from the registry run key is not the exe dir */ QApplication app(argc, argv); QDir::setCurrent(QCoreApplication::applicationDirPath()); } #endif QStringList args = char_array_to_stringlist(argv+1, argc-1); Q_INIT_RESOURCE(images); rsiface = NULL; NotifyQt *notify = NotifyQt::Create(); createRsIface(*notify); createRsControl(*rsiface, *notify); /* RetroShare Core Objects */ RsInit::InitRsConfig(); int initResult = RsInit::InitRetroShare(argc, argv); if (initResult < 0) { /* Error occured */ QApplication dummyApp (argc, argv); // needed for QMessageBox QMessageBox mb(QMessageBox::Critical, QObject::tr("RetroShare"), "", QMessageBox::Ok); mb.setWindowIcon(QIcon(":/images/rstray3.png")); switch (initResult) { case RS_INIT_AUTH_FAILED: std::cerr << "RsInit::InitRetroShare AuthGPG::InitAuth failed" << std::endl; mb.setText(QObject::tr("Inititialize failed. Wrong or missing installation of gpg.")); break; default: /* Unexpected return code */ std::cerr << "RsInit::InitRetroShare unexpected return code " << initResult << std::endl; mb.setText(QObject::tr("An unexpected error occured. Please report 'RsInit::InitRetroShare unexpected return code %1'.").arg(initResult)); break; } mb.exec(); return 1; } /* create global settings object path maybe wrong, when no profile exist in this case it can be use only for default values */ RshareSettings::Create (); /* Setup The GUI Stuff */ Rshare rshare(args, argc, argv, QString::fromStdString(RsInit::RsConfigDirectory())); std::string url = RsInit::getRetroShareLink(); if (!url.empty()) { /* start with RetroShare link */ EventReceiver eventReceiver; if (eventReceiver.sendRetroShareLink(QString::fromStdString(url))) { return 0; } /* Start RetroShare */ } QSplashScreen splashScreen(QPixmap(":/images/splash.png")/* , Qt::WindowStaysOnTopHint*/); switch (initResult) { case RS_INIT_OK: { /* Login Dialog */ /* check for existing Certificate */ std::string userName; StartDialog *sd = NULL; bool genCert = false; std::list<std::string> accountIds; if (RsInit::getAccountIds(accountIds) && (accountIds.size() > 0)) { sd = new StartDialog(); sd->show(); while(sd -> isVisible()) { rshare.processEvents(); #ifdef WIN32 Sleep(10); #else // __LINUX__ usleep(10000); #endif } /* if we're logged in */ genCert = sd->requestedNewCert(); delete (sd); } else { genCert = true; } if (genCert) { GenCertDialog gd; gd.exec (); } splashScreen.show(); } break; case RS_INIT_HAVE_ACCOUNT: { splashScreen.show(); splashScreen.showMessage(rshare.translate("SplashScreen", "Load profile"), Qt::AlignHCenter | Qt::AlignBottom); std::string preferredId, gpgId, gpgName, gpgEmail, sslName; RsInit::getPreferedAccountId(preferredId); if (RsInit::getAccountDetails(preferredId, gpgId, gpgName, gpgEmail, sslName)) { RsInit::SelectGPGAccount(gpgId); } // true: note auto-login is active std::string lockFile; int retVal = RsInit::LockAndLoadCertificates(true, lockFile); switch(retVal) { case 0: break; case 1: QMessageBox::warning( 0, QObject::tr("Multiple instances"), QObject::tr("Another RetroShare using the same profile is " "already running on your system. Please close " "that instance first\n Lock file:\n") + QString::fromStdString(lockFile)); return 1; case 2: QMessageBox::critical( 0, QObject::tr("Multiple instances"), QObject::tr("An unexpected error occurred when Retroshare" "tried to acquire the single instance lock\n Lock file:\n") + QString::fromStdString(lockFile)); return 1; case 3: QMessageBox::critical( 0, QObject::tr("Login Failure"), QObject::tr("Maybe password is wrong") ); return 1; default: std::cerr << "StartDialog::loadCertificates() unexpected switch value " << retVal << std::endl; } } break; default: /* Unexpected return code */ std::cerr << "RsInit::InitRetroShare unexpected return code " << initResult << std::endl; QMessageBox::warning(0, QObject::tr("RetroShare"), QObject::tr("An unexpected error occured. Please report 'RsInit::InitRetroShare unexpected return code %1'.").arg(initResult)); return 1; } splashScreen.showMessage(rshare.translate("SplashScreen", "Load configuration"), Qt::AlignHCenter | Qt::AlignBottom); rsicontrol->StartupRetroShare(); splashScreen.showMessage(rshare.translate("SplashScreen", "Create interface"), Qt::AlignHCenter | Qt::AlignBottom); /* recreate global settings object, now with correct path */ RshareSettings::Create (); RsharePeerSettings::Create(); #ifdef MINIMAL_RSGUI MessengerWindow::showYourself(); rshare.setQuitOnLastWindowClosed(true); splashScreen.hide(); #else Emoticons::load(); if (Settings->value(QString::fromUtf8("FirstRun"), true).toBool()) { splashScreen.hide(); Settings->setValue(QString::fromUtf8("FirstRun"), false); QuickStartWizard qstartWizard; qstartWizard.exec(); } 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&))); } } if (!url.empty()) { /* Now use link from the command line, because no RetroShare was running */ RetroShareLink link(QString::fromStdString(url)); if (link.valid()) { w->linkActivated(link.toUrl()); } } // 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. // qRegisterMetaType<FileDetail>("FileDetail") ; std::cerr << "connecting signals and slots" << std::endl ; QObject::connect(notify,SIGNAL(gotTurtleSearchResult(qulonglong,FileDetail)),w->searchDialog ,SLOT(updateFiles(qulonglong,FileDetail))) ; QObject::connect(notify,SIGNAL(diskFull(int,int)) ,w ,SLOT(displayDiskSpaceWarning(int,int))) ; QObject::connect(notify,SIGNAL(filesPreModChanged(bool)) ,w->sharedfilesDialog ,SLOT(preModDirectories(bool) )) ; QObject::connect(notify,SIGNAL(filesPostModChanged(bool)) ,w->sharedfilesDialog ,SLOT(postModDirectories(bool) )) ; QObject::connect(notify,SIGNAL(filesPostModChanged(bool)) ,w ,SLOT(postModDirectories(bool) )) ; QObject::connect(notify,SIGNAL(transfersChanged()) ,w->transfersDialog ,SLOT(insertTransfers() )) ; QObject::connect(notify,SIGNAL(friendsChanged()) ,w->friendsDialog ,SLOT(insertPeers() )) ; QObject::connect(notify,SIGNAL(publicChatChanged(int)) ,w->friendsDialog ,SLOT(publicChatChanged(int) )); QObject::connect(notify,SIGNAL(groupsChanged(int)) ,w->friendsDialog ,SLOT(groupsChanged(int) )); QObject::connect(notify,SIGNAL(privateChatChanged(int, int)) ,w ,SLOT(privateChatChanged(int, int) )); QObject::connect(notify,SIGNAL(neighboursChanged()) ,w->networkDialog ,SLOT(insertConnect() )) ; QObject::connect(notify,SIGNAL(messagesChanged()) ,w->messagesDialog ,SLOT(insertMessages() )) ; QObject::connect(notify,SIGNAL(messagesTagsChanged()) ,w->messagesDialog ,SLOT(messagesTagsChanged() )) ; QObject::connect(notify,SIGNAL(messagesChanged()) ,w ,SLOT(updateMessages() )) ; QObject::connect(notify,SIGNAL(forumsChanged()) ,w ,SLOT(updateForums() ), Qt::QueuedConnection); QObject::connect(notify,SIGNAL(channelsChanged(int)) ,w ,SLOT(updateChannels(int) ), Qt::QueuedConnection); QObject::connect(notify,SIGNAL(downloadCompleteCountChanged(int)) ,w ,SLOT(updateTransfers(int) )); QObject::connect(notify,SIGNAL(chatStatusChanged(const QString&,const QString&,bool)),w->friendsDialog,SLOT(updatePeerStatusString(const QString&,const QString&,bool))); QObject::connect(notify,SIGNAL(ownStatusMessageChanged()),w->friendsDialog,SLOT(loadmypersonalstatus())); QObject::connect(notify,SIGNAL(logInfoChanged(const QString&)) ,w->networkDialog,SLOT(setLogInfo(QString))) ; QObject::connect(notify,SIGNAL(discInfoChanged()) ,w->networkDialog,SLOT(updateNewDiscoveryInfo()),Qt::QueuedConnection) ; QObject::connect(notify,SIGNAL(errorOccurred(int,int,const QString&)),w,SLOT(displayErrorMessage(int,int,const QString&))) ; QObject::connect(w->friendsDialog,SIGNAL(friendsUpdated()),w->networkDialog,SLOT(insertConnect())) ; w->installGroupChatNotifier(); /* only show window, if not startMinimized */ if (RsInit::getStartMinimised() || Settings->getStartMinimized()) { splashScreen.close(); } else { w->show(); } /* Startup a Timer to keep the gui's updated */ QTimer *timer = new QTimer(w); timer -> connect(timer, SIGNAL(timeout()), notify, SLOT(UpdateGUI())); timer->start(1000); #endif // MINIMAL_RSGUI /* dive into the endless loop */ int ti = rshare.exec(); #ifndef MINIMAL_RSGUI delete w ; if (eventReceiver) { /* Destroy event receiver */ delete eventReceiver; eventReceiver = NULL; } /* cleanup */ PopupChatDialog::cleanupChat(); #endif // MINIMAL_RSGUI rsicontrol->rsGlobalShutDown(); Settings->sync(); delete Settings; return ti ; }