int muse_tui::userinput () { int ch; while ((ch = getch ()) != 'q') { warning ("input: int %d", ch); if ((ch > 48) & (ch <= (48 + MAX_CHANNELS))) { setactivechan (ch - 49); } else switch (ch) { case KEY_TAB: tabchan(); break; case KEY_F1: // F1 case 80: // does keypad work? warning ("request change to win 1"); changewin (0); break; case KEY_F2: // F2 case 81: // does keypad work? warning ("request change to win 2"); changewin (1); break; case KEY_F3: // F3 case 82: // does keypad work? warning ("request change to win 3"); changewin (2); break; case KEY_UP: chan[activechan].selprevitem(); break; case KEY_DOWN: chan[activechan].selnextitem(); break; case '+': chan[activechan].incrvol(); break; case '-': chan[activechan].decrvol(); break; case 'u': case 'U': newurl(); refresh(); break; case 'f': case 'F': newfile(); refresh(); break; case 't': case 'T': /* talk */ break; case 'a': case 'A': showabout(); refresh(); break; case 's': case 'S': /* speaker */ break; case 'l': case 'L': /* line-in */ break; case 'c': case 'C': /* connect */ break; case 'h': case 'H': /* connect */ showhelp(); refresh(); break; default: continue; } } return 0; }
/** Initialyse Stacked Page*/ void MainWindow::initStackedPage() { /* 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; } QList<QPair<MainPage*, QPair<QAction*, QListWidgetItem*> > > notify; /* Create the Main pages and actions */ QActionGroup *grp = new QActionGroup(this); addPage(newsFeed = new NewsFeed(ui->stackPages), grp, ¬ify); addPage(friendsDialog = new FriendsDialog(ui->stackPages), grp, ¬ify); #ifdef RS_USE_CIRCLES PeopleDialog *peopleDialog = NULL; addPage(peopleDialog = new PeopleDialog(ui->stackPages), grp, ¬ify); #endif IdDialog *idDialog = NULL; addPage(idDialog = new IdDialog(ui->stackPages), grp, ¬ify); #ifdef RS_USE_CIRCLES CirclesDialog *circlesDialog = NULL; addPage(circlesDialog = new CirclesDialog(ui->stackPages), grp, ¬ify); #endif addPage(transfersDialog = new TransfersDialog(ui->stackPages), grp, ¬ify); addPage(chatLobbyDialog = new ChatLobbyWidget(ui->stackPages), grp, ¬ify); addPage(messagesDialog = new MessagesDialog(ui->stackPages), grp, ¬ify); addPage(gxschannelDialog = new GxsChannelDialog(ui->stackPages), grp, ¬ify); addPage(gxsforumDialog = new GxsForumsDialog(ui->stackPages), grp, ¬ify); addPage(postedDialog = new PostedDialog(ui->stackPages), grp, ¬ify); #ifdef RS_USE_WIKI WikiDialog *wikiDialog = NULL; addPage(wikiDialog = new WikiDialog(ui->stackPages), grp, ¬ify); #endif #ifdef BLOGS addPage(blogsFeed = new BlogsDialog(ui->stackPages), grp, NULL); #endif 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(); pluginPage->setIconPixmap(icon); pluginPage->setPageName(QString::fromUtf8(rsPlugins->plugin(i)->getPluginName().c_str())); addPage(pluginPage, grp, ¬ify); } 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 addPage(pluginsPage = new PluginsPage(ui->stackPages), grp, NULL); #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)); addPage(getStartedPage = new GetStartedDialog(ui->stackPages), grp, NULL); } #endif /* Create the toolbar */ ui->toolBarPage->addActions(grp->actions()); connect(grp, SIGNAL(triggered(QAction *)), ui->stackPages, SLOT(showPage(QAction *))); #ifdef UNFINISHED addAction(new QAction(QIcon(IMAGE_UNFINISHED), tr("Unfinished"), ui->toolBar), &MainWindow::showApplWindow, SLOT(showApplWindow())); ui->toolBarAction->addSeparator(); notify += applicationWindow->getNotify(); #endif /** Add icon on Action bar */ addAction(new QAction(QIcon(IMAGE_ADDFRIEND), tr("Add"), ui->toolBarAction), &MainWindow::addFriend, SLOT(addFriend())); //addAction(new QAction(QIcon(IMAGE_NEWRSCOLLECTION), tr("New"), ui->toolBarAction), &MainWindow::newRsCollection, SLOT(newRsCollection())); addAction(new QAction(QIcon(IMAGE_PREFERENCES), tr("Options"), ui->toolBarAction), &MainWindow::showSettings, SLOT(showSettings())); addAction(new QAction(QIcon(IMAGE_ABOUT), tr("About"), ui->toolBarAction), &MainWindow::showabout, SLOT(showabout())); addAction(new QAction(QIcon(IMAGE_QUIT), tr("Quit"), ui->toolBarAction), &MainWindow::doQuit, SLOT(doQuit())); QList<QPair<MainPage*, QPair<QAction*, QListWidgetItem*> > >::iterator notifyIt; for (notifyIt = notify.begin(); notifyIt != notify.end(); ++notifyIt) { UserNotify *userNotify = notifyIt->first->getUserNotify(this); if (userNotify) { userNotify->initialize(ui->toolBarPage, notifyIt->second.first, notifyIt->second.second); connect(userNotify, SIGNAL(countChanged()), this, SLOT(updateTrayCombine())); userNotifyList.push_back(userNotify); } } }
/** 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); }
void MainWindow::About() { showabout(); }
/** Constructor */ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags) : RWindow("MainWindow", parent, flags) { /* Invoke the Qt Designer generated QObject setup routine */ ui.setupUi(this); /* Create RshareSettings object */ _settings = new RshareSettings(); setWindowTitle(tr("RetroShare %1 a secure decentralised commmunication platform").arg(retroshareVersion())); mSMPlayer = NULL; // Setting icons this->setWindowIcon(QIcon(QString::fromUtf8(":/images/rstray3.png"))); /* Create all the dialogs of which we only want one instance */ _bandwidthGraph = new BandwidthGraph(); messengerWindow = new MessengerWindow(); _preferencesWindow = new PreferencesWindow(); applicationWindow = new ApplicationWindow(); applicationWindow->hide(); /** 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( showPreferencesWindow()) ); connect(ui.actionMessenger, SIGNAL(triggered()), this, SLOT( showMessengerWindow()) ); connect(ui.actionSMPlayer, SIGNAL(triggered()), this, SLOT( showsmplayer()) ); connect(ui.actionAbout, SIGNAL(triggered()), this, SLOT( showabout()) ); connect(ui.actionColor, SIGNAL(triggered()), this, SLOT( setStyle()) ); //connect(ui.actionSettings, SIGNAL(triggered()), this, SLOT( showSettings()) ); /** 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())); /* load the StyleSheet*/ loadStyleSheet(Rshare::stylesheet()); /* Create the Main pages and actions */ QActionGroup *grp = new QActionGroup(this); ui.stackPages->add(networkDialog = new NetworkDialog(ui.stackPages), createPageAction(QIcon(IMAGE_NETWORK2), tr("Network"), grp)); ui.stackPages->add(peersDialog = new PeersDialog(ui.stackPages), createPageAction(QIcon(IMAGE_PEERS), tr("Friends"), grp)); //PeersFeed *peersFeed = NULL; //ui.stackPages->add(peersFeed = new PeersFeed(ui.stackPages), // createPageAction(QIcon(IMAGE_PEERS), tr("Peers"), grp)); #ifdef TURTLE_HOPPING ui.stackPages->add(turtleDialog = new TurtleSearchDialog(ui.stackPages), createPageAction(QIcon(IMAGE_TURTLE), tr("Turtle"), grp)); #endif ui.stackPages->add(searchDialog = new SearchDialog(ui.stackPages), createPageAction(QIcon(IMAGE_SEARCH), tr("Search"), grp)); ui.stackPages->add(transfersDialog = new TransfersDialog(ui.stackPages), createPageAction(QIcon(IMAGE_TRANSFERS), tr("Transfers"), grp)); //TransferFeed *transferFeed = NULL; //ui.stackPages->add(transferFeed = new TransferFeed(ui.stackPages), // createPageAction(QIcon(IMAGE_LINKS), tr("Transfers"), grp)); ui.stackPages->add(sharedfilesDialog = new SharedFilesDialog(ui.stackPages), createPageAction(QIcon(IMAGE_FILES), tr("Files"), grp)); //MsgFeed *msgFeed = NULL; //ui.stackPages->add(msgFeed = new MsgFeed(ui.stackPages), // createPageAction(QIcon(IMAGE_MESSAGES), tr("Messages"), grp)); ui.stackPages->add(messagesDialog = new MessagesDialog(ui.stackPages), createPageAction(QIcon(IMAGE_MESSAGES), tr("Messages"), grp)); LinksDialog *linksDialog = NULL; #ifdef RS_RELEASE_VERSION channelsDialog = NULL; ui.stackPages->add(linksDialog = new LinksDialog(ui.stackPages), createPageAction(QIcon(IMAGE_LINKS), tr("Links Cloud"), grp)); ForumsDialog *forumsDialog = NULL; ui.stackPages->add(forumsDialog = new ForumsDialog(ui.stackPages), createPageAction(QIcon(IMAGE_FORUMS), tr("Forums"), grp)); #else channelsDialog = NULL; ui.stackPages->add(linksDialog = new LinksDialog(ui.stackPages), createPageAction(QIcon(IMAGE_LINKS), tr("Links Cloud"), grp)); ChannelFeed *channelFeed = NULL; ui.stackPages->add(channelFeed = new ChannelFeed(ui.stackPages), createPageAction(QIcon(IMAGE_CHANNELS), tr("Channels"), grp)); ForumsDialog *forumsDialog = NULL; ui.stackPages->add(forumsDialog = new ForumsDialog(ui.stackPages), createPageAction(QIcon(IMAGE_FORUMS), tr("Forums"), grp)); #endif NewsFeed *newsFeed = NULL; ui.stackPages->add(newsFeed = new NewsFeed(ui.stackPages), createPageAction(QIcon(IMAGE_NEWSFEED), tr("News Feed"), grp)); #ifdef PLUGINMGR ui.stackPages->add(pluginsPage = new PluginsPage(ui.stackPages), createPageAction(QIcon(IMAGE_PLUGINS), tr("Plugins"), grp)); #endif /* Create the toolbar */ ui.toolBar->addActions(grp->actions()); ui.toolBar->addSeparator(); connect(grp, SIGNAL(triggered(QAction *)), ui.stackPages, SLOT(showPage(QAction *))); #ifdef RS_RELEASE_VERSION #else addAction(new QAction(QIcon(IMAGE_UNFINISHED), tr("Unfinished"), ui.toolBar), SLOT(showApplWindow())); #endif /* Select the first action */ grp->actions()[0]->setChecked(true); /* also an empty list of chat windows */ messengerWindow->setChatDialog(peersDialog); // Allow to play files from SharedFilesDialog. connect(sharedfilesDialog, SIGNAL(playFiles( QStringList )), this, SLOT(playFiles( QStringList ))); connect(transfersDialog, SIGNAL(playFiles( QStringList )), this, SLOT(playFiles( QStringList ))); /** StatusBar section **/ peerstatus = new PeerStatus(); statusBar()->addWidget(peerstatus); dhtstatus = new DHTStatus(); statusBar()->addWidget(dhtstatus); natstatus = new NATStatus(); statusBar()->addWidget(natstatus); QWidget *widget = new QWidget(); QSizePolicy sizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred); sizePolicy.setHorizontalStretch(0); sizePolicy.setVerticalStretch(0); sizePolicy.setHeightForWidth(widget->sizePolicy().hasHeightForWidth()); widget->setSizePolicy(sizePolicy); QHBoxLayout *horizontalLayout = new QHBoxLayout(widget); horizontalLayout->setContentsMargins(0, 0, 0, 0); horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout")); _hashing_info_label = new QLabel(widget) ; _hashing_info_label->setObjectName(QString::fromUtf8("label")); horizontalLayout->addWidget(_hashing_info_label); QSpacerItem *horizontalSpacer = new QSpacerItem(1000, 0, QSizePolicy::Expanding, QSizePolicy::Minimum); horizontalLayout->addItem(horizontalSpacer); statusBar()->addPermanentWidget(widget); _hashing_info_label->hide() ; ratesstatus = new RatesStatus(); statusBar()->addPermanentWidget(ratesstatus); /******* Status Bar end ******/ /* Create the actions that will go in the tray menu */ createActions(); /****** * This is an annoying warning I get all the time... * (no help!) * * if (!QSystemTrayIcon::isSystemTrayAvailable()) QMessageBox::warning(0, tr("System tray is unavailable"), tr("System tray unavailable")); ******/ // Tray icon Menu menu = new QMenu(this); QObject::connect(menu, SIGNAL(aboutToShow()), this, SLOT(updateMenu())); toggleVisibilityAction = menu->addAction(QIcon(IMAGE_RETROSHARE), tr("Show/Hide"), this, SLOT(toggleVisibilitycontextmenu())); menu->addSeparator(); menu->addAction(_messengerwindowAct); menu->addAction(_messagesAct); menu->addAction(_bandwidthAct); /* bandwidth only in development version */ #ifdef RS_RELEASE_VERSION #else menu->addAction(_appAct); #endif menu->addAction(_prefsAct); //menu->addAction(_smplayerAct); menu->addAction(_helpAct); menu->addSeparator(); menu->addAction(QIcon(IMAGE_MINIMIZE), tr("Minimize"), this, SLOT(showMinimized())); menu->addAction(QIcon(IMAGE_MAXIMIZE), tr("Maximize"), this, SLOT(showMaximized())); menu->addSeparator(); menu->addAction(QIcon(IMAGE_CLOSE), tr("&Quit"), this, SLOT(doQuit())); // End of Icon Menu // Create the tray icon trayIcon = new QSystemTrayIcon(this); trayIcon->setToolTip(tr("RetroShare")); trayIcon->setContextMenu(menu); trayIcon->setIcon(QIcon(IMAGE_RETROSHARE)); connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(toggleVisibility(QSystemTrayIcon::ActivationReason))); trayIcon->show(); QTimer *timer = new QTimer(this); timer->connect(timer, SIGNAL(timeout()), this, SLOT(updateStatus())); timer->start(1000); }