int SasiApp::exec() { QSplashScreen* splash = 0; QPixmap splash_pixmap; QWidget* show_screen = desktop()->screen( 0 ); if ( splash_pixmap.load( SLcustomizations().GraphicsDir() + "/splash.png" ) ) { splash = new QSplashScreen(show_screen,splash_pixmap); splash->show(); } wxLogChain* logchain = 0; wxLog::SetActiveTarget( new wxLogChain( new wxLogStream( &std::cout ) ) ); //this needs to called _before_ mainwindow instance is created wxInitAllImageHandlers(); wxFileSystem::AddHandler(new wxZipFSHandler); wxSocketBase::Initialize(); usync().FastLoadUnitSyncLibInit( ); QDeclarativeView view(show_screen); QString qmldir; try { qmldir = SLcustomizations().QmlDir(); } catch ( Customizations::DataException& e ) { //for some f****d up reason the strings get internally f****d up w/o the hardcopy QList<QString> copy = e.errors_; QErrorWindow error_win ( copy ); return error_win.exec(); } AudioManager audio_manager (this); audio_manager.start(); view.engine()->addImportPath( qmldir ); #ifdef __WXMSW__ //for webkit declarative plugin view.engine()->addImportPath( QDir( QCoreApplication::applicationDirPath() + "/imports").absolutePath() ); #endif // Visual initialization view.engine()->addImageProvider("minimaps", new MinimapImageProvider); view.engine()->addImageProvider("graphics", new GraphicsProvider); view.engine()->addImageProvider("sides", new SideImageProvider); #if USE_OPENGL QGLFormat format = QGLFormat::defaultFormat(); #ifdef Q_WS_MAC format.setSampleBuffers(true); #else format.setSampleBuffers(false); #endif QGLWidget *glWidget = new QGLWidget(format, &view); view.setViewport(glWidget); view.setViewportUpdateMode(QGraphicsView::MinimalViewportUpdate); #endif view.setAttribute(Qt::WA_OpaquePaintEvent); view.setAttribute(Qt::WA_NoSystemBackground); view.setResizeMode(QDeclarativeView::SizeRootObjectToView); MaplistModel maplist_model( usync().GetMapList() ); SkirmishModel skirmish_model; SideModel side_model( SLcustomizations().GetModname() ); PresetModel preset_model(this); ScreenResolutionModel screenres_model(this); spring().connect( &spring(), SIGNAL(springStarted()), &audio_manager, SLOT(pause())); spring().connect( &spring(), SIGNAL(springStopped()), &audio_manager, SLOT(resume())); QObject::connect((QObject*)view.engine(), SIGNAL(quit()), this, SLOT(quit())); QObject::connect((QObject*)view.engine(), SIGNAL(quit()), &audio_manager, SLOT(doQuit())); QDeclarativeContext* ctxt = view.rootContext(); ctxt->setContextProperty("maplistModel", &maplist_model ); ctxt->setContextProperty("skirmishModel", &skirmish_model ); ctxt->setContextProperty("sideModel", &side_model ); ctxt->setContextProperty("audioManager", &audio_manager ); ctxt->setContextProperty("presetModel", &preset_model ); ctxt->setContextProperty("screenresModel", &screenres_model ); const int sleep_seconds = -1; for ( int i = sleep_seconds; splash && i > 0; i-- ) { splash->showMessage( QString("sleeping for %1 seconds, just to show you this").arg( i ), Qt::AlignHCenter | Qt::AlignBottom ); processEvents(); sleep( 1 ); } // view.showFullScreen(); if ( splash ) splash->finish(&view); view.setSource(QUrl(qmldir + "/main.qml")); QObject::connect(this, SIGNAL(appLoaded()), (QObject*)view.rootObject(), SLOT(onAppLoaded())); QList<QDeclarativeError> errors = view.errors(); if ( errors.size() ) { QErrorWindow error_window ( errors ); return error_window.exec(); } view.show(); view.setFocus(); emit appLoaded(); int ret = QApplication::exec(); audio_manager.wait( 5 /*seconds*/ ); return ret; }
void AsyncCDDBPLookup::read() { switch ( state_ ) { case WaitingForGreeting: if ( !parseGreeting( readLine() ) ) { result_ = ServerError; doQuit(); return; } doHandshake(); break; case WaitingForHandshake: if ( !parseHandshake( readLine() ) ) { result_ = ServerError; doQuit(); return; } doProto(); break; case WaitingForProtoResponse: // Ignore the response for now readLine(); doQuery(); break; case WaitingForQueryResponse: result_ = parseQuery( readLine() ); switch ( result_ ) { case Success: requestCDInfoForMatch(); break; case MultipleRecordFound: state_ = WaitingForMoreMatches; break; default: // Error :( doQuit(); return; } break; case WaitingForMoreMatches: { QString line = readLine(); if (line.startsWith(QLatin1String( "." ))) requestCDInfoForMatch(); else parseExtraMatch( line ); } break; case WaitingForCDInfoResponse: { Result result = parseRead( readLine() ); if ( Success != result ) { result_ = result; doQuit(); return; } state_ = WaitingForCDInfoData; } break; case WaitingForCDInfoData: { QString line = readLine(); if (line.startsWith(QLatin1String( "." ))) { parseCDInfoData(); requestCDInfoForMatch(); } else cdInfoBuffer_ << line; } break; case WaitingForQuitResponse: state_ = Idle; char c; while ( socket_->bytesAvailable() ) socket_->getChar(&c); close(); emit finished( result_ ); break; default: break; } }
bool MainWindow::executeCommand(const DRUIDString & command) { static const wxString runStatus(wxT("Executing command")); static const wxString inputRequired(wxT("Input Required...")); static const wxString integerInputRequired(wxT("Integer input Required...")); static const wxString numericInputRequired(wxT("Numeric input Required...")); static const wxString runStatusDone(wxT(" completed")); SetStatusText(runStatus); uint8_t wait_attempts=0; while (executing_request && wait_attempts++ < 5) usleep(1000); touchLastInteraction(); DRUID::SerialUIUserPtr serial_user = connection->serialUser(); DRUID_DEBUG2("Doing send+rcv for", command); executing_request = true; if ( (! serial_user->sendAndReceive(command)) || serial_user->hasError()) { wxString errMsg(DRUID_STDSTRING_TOWX(serial_user->errorMessage())); SetStatusText(errMsg); MW_RETURNFROM_EXECUTECOMMAND(false); } awaiting_input = false; wxString cmdName(DRUID_STDSTRING_TOWX(command)); if (serial_user->inputRequired()) { serial_user->flushReceiveBuffer(); serial_user->setAutoReplaceLastMessage(false); { // may have more than a single input to enter, so we do/while it... DRUID_DEBUG("Need input..."); oldFocus = this->FindFocus(); awaiting_input = true; DRUID::UserInputType reqType = serial_user->inputRequiredType(); // get the name from the prompt, if possible. if (serial_user->inputRequiredPromptString().size()) { cmdName = DRUID_STDSTRING_TOWX(serial_user->inputRequiredPromptString()); } bool streamSuccess; switch (reqType) { case DRUID::InputType_Numeric: DRUID_DEBUG("Numeric input required"); SetStatusText(numericInputRequired); break; case DRUID::InputType_Integer: DRUID_DEBUG("Numeric (int) input required"); SetStatusText(integerInputRequired); break; case DRUID::InputType_Stream: DRUID_DEBUG("Want a stream (file) upload"); // little bit different, this one... we need to select a file and stream its contents in... streamSuccess = sendFileStream(); // outputTextCtrl->AppendText(DRUID_STDSTRING_TOWX(serial_user->lastMessage())); awaiting_input = false; MW_RETURNFROM_EXECUTECOMMAND(streamSuccess); break; default: DRUID_DEBUG("String input required"); SetStatusText(inputRequired); break; } input->acceptInput(true, cmdName, reqType); } } else { wxString stat(cmdName); stat += runStatusDone; SetStatusText(stat); if (serial_user->messageReceived()) { outputTextCtrl->AppendText(DRUID_STDSTRING_TOWX(serial_user->lastMessage())); serial_user->lastMessageClear(); } serial_user->setAutoReplaceLastMessage(true); if (serial_user->requestedTerminate()) { SetStatusText(wxT("GUI Termination requested")); // TODO: FIXME -- show user we aren't just dying but terminating on purpose. doQuit(); MW_RETURNFROM_EXECUTECOMMAND(true); } if (useStateTracking() && serial_user->numTrackedVariables()) { last_interaction = 0; } } MW_RETURNFROM_EXECUTECOMMAND(true); }
void NoSystemTrayDialog::buttonDoQuit() { emit doQuit(); accept(); }
void MainWindow::OnQuit(wxCommandEvent&) { doQuit(); }
/** 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); }
/** 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); }
void KTPauseLayerTest::itemClick(cocos2d::CCMenuItemImage *item) { doQuit(); }