void TrayIcon::updateIcon() { bool unreads = Logic::GetRecentsModel()->totalUnreads() != 0; if (unreads != HaveUnreads_) { HaveUnreads_ = unreads; #ifdef _WIN32 if (ptbl) ptbl->SetOverlayIcon((HWND)MainWindow_->winId(), unreads ? qt_pixmapToWinHICON(*TaskBarOverlay_) : HICON(), L""); else MainWindow_->setWindowIcon(unreads ? *Unreads_ : *Base_); #endif //_WIN32 if (!platform::is_apple()) { Icon_->setIcon(unreads ? *TrayUnreads_ : *TrayBase_); } else { setMacIcon(); } } updateStatus(); }
void TrayIcon::init() { MessageAlert_->hide(); MainWindow_->setWindowIcon(*Base_); if (!platform::is_apple()) { Icon_->setIcon(*TrayBase_); } else { setMacIcon(); } onlineAction_ = dndAction_ = invAction_ = NULL; #ifdef __APPLE__ onlineAction_ = Menu_->addAction(QIcon(":/resources/content_status_online_200.png"), QT_TR_NOOP("Online"), this, SLOT(menuStateOnline())); dndAction_ = Menu_->addAction(QIcon(":/resources/content_status_dnd_200.png"), QT_TR_NOOP("Do not disturb"), this, SLOT(menuStateDoNotDisturb())); invAction_ = Menu_->addAction(QIcon(":/resources/content_status_invisible_200.png"), QT_TR_NOOP("Invisible"), this, SLOT(menuStateInvisible())); updateStatus(); Menu_->addSeparator(); //#ifdef UPDATES // Menu_->addAction(QIcon(), QT_TRANSLATE_NOOP("context_menu", "Check for updates..."), parent(), SLOT(checkForUpdates())); // Menu_->addSeparator(); //#endif Menu_->addAction(QT_TRANSLATE_NOOP("context_menu","Quit"), parent(), SLOT(exit())); #else Menu_->addActionWithIcon(QIcon(Utils::parse_image_name(":/resources/dialog_quit_100.png")), QT_TRANSLATE_NOOP("context_menu","Quit"), parent(), SLOT(exit())); #endif Icon_->setContextMenu(Menu_); connect(Icon_, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(activated(QSystemTrayIcon::ActivationReason)), Qt::QueuedConnection); Icon_->show(); }
int main(int argc, char **argv) { // print version info if(argc == 2) { string param(argv[1]); if(param == "--version" || param == "-v") { cout << "Version information:" << endl; cout << "Graphics Application Revision: " << ERP_GIT_VERSION << endl; cout << "BOINC Revision: " << SVN_VERSION << endl; exit(0); } } // enable BOINC diagnostics // TODO: we might want to optimize this for glibc- and mingw-based stacktraces! boinc_init_graphics_diagnostics(BOINC_DIAG_DEFAULTS); #ifdef __APPLE__ setMacIcon(argv[0], MacAppIconData, sizeof(MacAppIconData)); #endif // choose application to be build/used GraphicsEngineFactory::Applications scienceApplication; #ifdef SCIENCE_APP scienceApplication = GraphicsEngineFactory::SCIENCE_APP; #else scienceApplication = GraphicsEngineFactory::EinsteinS5R3; #endif // prepare main objects WindowManager window; ResourceFactory factory; AbstractGraphicsEngine *graphics = GraphicsEngineFactory::createInstance( GraphicsEngineFactory::Starsphere, scienceApplication); if(!graphics) { cerr << "Requested graphics engine could not be found/instantiated!" << endl; exit(1); } // initialize window manager if(!window.initialize()) { cerr << "Window manager could not be initialized!" << endl; delete graphics; exit(1); } // create font and icon resource instances const Resource *fontResource = factory.createInstance("FontSansSerif"); const Resource *iconResource = factory.createInstance("AppIconBMP"); if(fontResource == NULL) { cerr << "Font resource could not be loaded!" << endl; delete graphics; exit(1); } if(fontResource->data()->size() <= 0) { cerr << "Font resource could not be loaded!" << endl; delete graphics; delete fontResource; exit(1); } if(iconResource != NULL && iconResource->data()->size() > 0) { window.setWindowIcon(&iconResource->data()->at(0), iconResource->data()->size()); delete iconResource; } else { cerr << "Icon resource could not be loaded! Continuing anyway..." << endl; } window.setWindowCaption("Einstein@Home"); // register starsphere as event observer window.registerEventObserver(graphics); // pepare rendering graphics->initialize(window.windowWidth(), window.windowHeight(), fontResource); graphics->refreshBOINCInformation(); // check optional command line parameters if(argc == 2) { string param(argv[1]); if(param == "--fullscreen") { // set non-interactive mode (must do this first on Apple) window.setScreensaverMode(true); } if(param == "--fullscreen" || param == "--demo") { // switch to fullscreen (on windoze: after init!) window.toggleFullscreen(); #ifdef __APPLE__ SetMacSSLevel(); #endif } } // enter main event loop window.eventLoop(); // clean up end exit window.unregisterEventObserver(graphics); delete graphics; delete fontResource; exit(0); }
void TrayIcon::myInfo() { setMacIcon(); updateStatus(); }
int main(int argc, char** argv) { int retval = 0, i; FORCE_FRAME_POINTER; run_stage=PREGRX; g_argc=argc; if (!(g_argv=(char **)calloc(argc+2,sizeof(char *)))) { exit(MALLOC_FAILED); } setbuf(stdout, 0); bool standalone = false; g_argv[0]=argv[0]; for (i=1; i<argc; i++) { g_argv[i]=argv[i]; char *p=argv[i]; while (*p=='-') p++; if (!strncmp(p,"vers",4)) { print_version(); exit(0); } else if (!strncmp(p,"verb",4)) { verbose = true; } else if (!strncmp(p, "st", 2)) { standalone = true; #ifdef BOINC_APP_GRAPHICS nographics_flag = true; #endif } else if (!strncmp(p, "nog", 3)) { #ifdef BOINC_APP_GRAPHICS nographics_flag = true; #endif } else if (!strncmp(p, "not", 3)) { notranspose_flag = true; } else if (!strncmp(p, "def", 3)) { default_functions_flag = true; } else { fprintf(stderr, "bad arg: %s\n", argv[i]); usage(); exit(1); } } try { // Initialize Diagnostics // unsigned long dwDiagnosticsFlags = 0; dwDiagnosticsFlags = BOINC_DIAG_DUMPCALLSTACKENABLED | BOINC_DIAG_HEAPCHECKENABLED | BOINC_DIAG_TRACETOSTDERR | BOINC_DIAG_REDIRECTSTDERR; retval = boinc_init_diagnostics(dwDiagnosticsFlags); if (retval) { SETIERROR(retval, "from boinc_init_diagnostics()"); } #ifdef __APPLE__ setMacIcon(argv[0], MacAppIconData, sizeof(MacAppIconData)); #ifdef __i386__ rlimit rlp; getrlimit(RLIMIT_STACK, &rlp); rlp.rlim_cur = rlp.rlim_max; setrlimit(RLIMIT_STACK, &rlp); #endif #endif // Initialize BOINC // boinc_parse_init_data_file(); boinc_get_init_data(app_init_data); #ifdef BOINC_APP_GRAPHICS sah_graphics_init(app_init_data); #endif retval = boinc_init(); if (retval) { SETIERROR(retval, "from boinc_init()"); } worker(); } catch (seti_error e) { e.print(); exit(static_cast<int>(e)); } return 0; }