//! constructor TraceCounter::TraceCounter() : // comand line processing firstArg_ (NULL), lastArg_ (NULL), argStrSize_ (0), commandLine_ (NULL), commandLineSz_ (0), counter1_ (NULL), counter2_ (NULL), counter1Sz_ (0), counter2Sz_ (0), // result of different command line opts overview_ (false), switchRandom_ (false), switchByPhase_ (false), noLog_ (false), writeByPhase_ (false), // store between start/stop of counter read execEP_ (-1), startEP_ (0.0), genStart_ (-1), // store state idleTime_ (0.0), phase_ (-1), reductionPhase_(-1), traceOn_ (false), status_ (IDLE), dirty_ (false) { for (int i=0; i<NUM_COUNTER_ARGS; i++) { registerArg(&COUNTER_ARG[i]); } }
//---------------------------------------------------------------------------- GLWidget::GLWidget(int& argc, char *argv[]): Configurable("QGLWidget"), _cur_fbo(0), _do_drag(false), _flags(0), _server(&_mutex_slot_links, &_cond_render, this) { QApplication::setOrganizationDomain("icg.tugraz.at"); QApplication::setOrganizationName("icg.tugraz.at"); QApplication::setApplicationName("VisLinks"); const QDir config_dir = QStandardPaths::writableLocation(QStandardPaths::DataLocation); const QString user_config = config_dir.filePath("config.xml"); { // Ensure config path and user config file exist QDir().mkpath(config_dir.path()); QFile file( user_config ); if( !file.open(QIODevice::ReadWrite | QIODevice::Text) ) LOG_ERROR("Failed to open user config!"); else if( !file.size() ) { LOG_INFO("Creating empty user config in '" << user_config << "'"); file.write( "<!-- VisLinks user config (overrides config file) -->\n" "<config/>" ); } } //-------------------------------- // Setup opengl and window //-------------------------------- // fullscreen setGeometry( QGuiApplication::primaryScreen()->availableVirtualGeometry() ); // don't allow user to change the window size setFixedSize( size() ); // transparent, always on top window without any decoration setWindowFlags( Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::MSWindowsOwnDC | Qt::WindowTransparentForInput //| Qt::X11BypassWindowManagerHint ); setAttribute(Qt::WA_ShowWithoutActivating); setAttribute(Qt::WA_TranslucentBackground); #ifdef USE_DESKTOP_BLEND1 //setAttribute(Qt::WA_TranslucentBackground); #else //setWindowOpacity(0.5); #endif #if 0 #if defined(WIN32) || defined(_WIN32) setMask(QRegion(size().width() - 2, size().height() - 2, 1, 1)); #else setMask(QRegion(-1, -1, 1, 1)); #endif #endif setMouseTracking(true); //-------------------------------- // Setup component system //-------------------------------- if( argc != 2 ) qFatal("Usage: %s <config>", argv[0]); assert(argc == 2 && argv && argv[1]); publishSlots(_core.getSlotCollector()); if( !_config.initFrom(argv[1]) ) qFatal("Failed to read config"); _user_config.initFrom( to_string(user_config) ); _core.startup(); _core.attachComponent(&_config); _core.attachComponent(&_user_config); _core.attachComponent(&_server); #ifdef USE_GPU_ROUTING _core.attachComponent(&_cost_analysis); #endif _core.attachComponent(&_routing_cpu); _core.attachComponent(&_routing_cpu_dijkstra); _core.attachComponent(&_routing_dummy); #ifdef USE_GPU_ROUTING _core.attachComponent(&_routing_gpu); #endif _core.attachComponent(&_renderer); _core.attachComponent(this); registerArg("DebugDesktopImage", _debug_desktop_image); registerArg("DumpScreenshot", _dump_screenshot = 0); _core.init(); LinksRouting::SlotSubscriber subscriber = _core.getSlotSubscriber(); subscribeSlots(subscriber); QSurfaceFormat fmt; fmt.setRenderableType(QSurfaceFormat::RenderableType::OpenGL); fmt.setProfile(QSurfaceFormat::OpenGLContextProfile::CoreProfile); fmt.setAlphaBufferSize(8); _offscreen_surface.setFormat(fmt); _offscreen_surface.setScreen( QGuiApplication::primaryScreen() ); _offscreen_surface.create(); _gl_ctx.setFormat(fmt); if( !_gl_ctx.create() ) qFatal("Failed to create OpenGL context."); if( !_gl_ctx.format().hasAlpha() ) qFatal("Failed to enable alpha blending."); if( !_gl_ctx.makeCurrent(&_offscreen_surface) ) qFatal("Could not activate OpenGL context."); // _render_thread = // QSharedPointer<RenderThread>(new RenderThread(this, width(), height())); // _gl_ctx->moveToThread(_render_thread.data()); //std::cout << "Is virtual desktop: " // << QApplication::desktop()->isVirtualDesktop() // << std::endl; }