SetupPluginsDialog::SetupPluginsDialog(IPluginManager *APluginManager, QDomDocument APluginsSetup, QWidget *AParent) : QDialog(AParent) { REPORT_VIEW; ui.setupUi(this); setAttribute(Qt::WA_DeleteOnClose, true); IconStorage::staticStorage(RSR_STORAGE_MENUICONS)->insertAutoIcon(this,MNI_PLUGINMANAGER_SETUP,0,0,"windowIcon"); FPluginManager = APluginManager; FPluginsSetup = APluginsSetup; FModel.setColumnCount(1); FProxy.setSourceModel(&FModel); FProxy.setFilterRole(PDR_FILTER); FProxy.setFilterCaseSensitivity(Qt::CaseInsensitive); ui.tbvPlugins->setModel(&FProxy); ui.tbvPlugins->verticalHeader()->hide(); ui.tbvPlugins->horizontalHeader()->hide(); ui.tbvPlugins->setItemDelegate(new AdvancedItemDelegate(ui.tbvPlugins)); connect(ui.sleSearch,SIGNAL(searchStart()),SLOT(onSearchLineEditSearchStart())); connect(ui.chbDisabled,SIGNAL(clicked(bool)),SLOT(onDisabledCheckButtonClicked())); connect(ui.chbWithErrors,SIGNAL(clicked(bool)),SLOT(onWithErrorsCheckButtonClicked())); connect(ui.dbbButtons,SIGNAL(clicked(QAbstractButton *)),SLOT(onDialogButtonClicked(QAbstractButton *))); connect(ui.lblHomePage, SIGNAL(linkActivated(const QString &)),SLOT(onHomePageLinkActivated(const QString &))); connect(ui.lblDependsOn, SIGNAL(linkActivated(const QString &)),SLOT(onDependsLinkActivated(const QString &))); connect(ui.lblDependsFor, SIGNAL(linkActivated(const QString &)),SLOT(onDependsLinkActivated(const QString &))); connect(ui.tbvPlugins->selectionModel(),SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)),SLOT(onCurrentPluginChanged(const QModelIndex &, const QModelIndex &))); restoreGeometry(Options::fileValue("misc.setup-plugins-dialog.geometry").toByteArray()); updatePlugins(); }
void configbuttonCreateMenu(CONFIGBUTTON *c) { struct PLUGIN_SUB_ENTRY *plugin_sub; int i; GtkWidget *image; GtkWidget *submenu; c->menu = gtk_menu_new(); updatePlugins(c); gtk_status_icon_set_from_stock(c->icon, GTK_STOCK_PREFERENCES); for (i = 0; i < c->plugins; i++) { c->plugin[i].item = gtk_image_menu_item_new_with_label(c->plugin[i].info->label); if (c->plugin[i].info->icon_path != NULL) { image = gtk_image_new_from_file(c->plugin[i].info->icon_path); gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(c->plugin[i].item), image); } if (c->plugin[i].info->submenu == NULL) g_signal_connect(G_OBJECT(c->plugin[i].item), "activate", G_CALLBACK(configbuttonActivate), &c->plugin[i]); else { plugin_sub = c->plugin[i].info->submenu; submenu = gtk_menu_new(); while (plugin_sub != NULL) { if (plugin_sub->visible == 0) { plugin_sub = plugin_sub->next; continue; } plugin_sub->item = gtk_image_menu_item_new_with_label(plugin_sub->label); if (plugin_sub->icon_path != NULL) { image = gtk_image_new_from_file(plugin_sub->icon_path); gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(plugin_sub->item), image); } g_signal_connect(G_OBJECT(plugin_sub->item), "activate", G_CALLBACK(configbuttonActivateSubmenu), plugin_sub); gtk_menu_shell_append(GTK_MENU_SHELL(submenu), plugin_sub->item); plugin_sub->activate = c->plugin[i].activate; plugin_sub = plugin_sub->next; } gtk_menu_item_set_submenu(GTK_MENU_ITEM(c->plugin[i].item), submenu); } gtk_menu_shell_append(GTK_MENU_SHELL(c->menu), c->plugin[i].item); } gtk_widget_show_all(c->menu); return; }
SetupPluginsDialog::SetupPluginsDialog(IPluginManager *APluginManager, QDomDocument APluginsSetup, QWidget *AParent) : QDialog(AParent) { ui.setupUi(this); IconStorage::staticStorage(RSR_STORAGE_MENUICONS)->insertAutoIcon(this,MNI_PLUGINMANAGER_SETUP,0,0,"windowIcon"); StyleStorage::staticStorage(RSR_STORAGE_STYLESHEETS)->insertAutoStyle(this, STS_PLUGINMANAGER_SETUPPLUGINSDIALOG); CustomBorderContainer *border = NULL; //CustomBorderStorage::staticStorage(RSR_STORAGE_CUSTOMBORDER)->addBorder(this, CBS_DIALOG); if (border) { border->setAttribute(Qt::WA_DeleteOnClose, true); connect(border, SIGNAL(closeClicked()), SLOT(reject())); connect(this, SIGNAL(accepted()), border, SLOT(closeWidget())); connect(this, SIGNAL(rejected()), border, SLOT(closeWidget())); } else { setAttribute(Qt::WA_DeleteOnClose,true); } FPluginManager = APluginManager; FPluginsSetup = APluginsSetup; updateLanguage(); connect(ui.cmbLanguage,SIGNAL(currentIndexChanged(int)),SLOT(onCurrentLanguageChanged(int))); updatePlugins(); ui.twtPlugins->horizontalHeader()->setResizeMode(COL_NAME,QHeaderView::Stretch); ui.twtPlugins->horizontalHeader()->setResizeMode(COL_FILE,QHeaderView::ResizeToContents); connect(ui.twtPlugins,SIGNAL(currentItemChanged(QTableWidgetItem *, QTableWidgetItem *)),SLOT(onCurrentPluginChanged(QTableWidgetItem *, QTableWidgetItem *))); connect(ui.dbbButtons,SIGNAL(clicked(QAbstractButton *)),SLOT(onDialogButtonClicked(QAbstractButton *))); connect(ui.lblHomePage, SIGNAL(linkActivated(const QString &)),SLOT(onHomePageLinkActivated(const QString &))); ui.cmbCountry->setView(new QListView); ui.cmbLanguage->setView(new QListView); QString ns = CustomBorderStorage::isBordered(this) ? QString::null : QString("system-border"); window()->restoreGeometry(Options::fileValue("misc.setup-plugins-dialog.geometry",ns).toByteArray()); }
void ShareEngine::init() { connect(KSycoca::self(), SIGNAL(databaseChanged(QStringList)), this, SLOT(updatePlugins(QStringList))); updatePlugins(QStringList() << "services"); }
void eventLoop (void) { XEvent event; struct pollfd ufd; int timeDiff; struct timeval tv; Region tmpRegion; CompDisplay *display = compDisplays; CompScreen *s = display->screens; int timeToNextRedraw = 0; CompWindow *move = 0; int px = 0, py = 0; CompTimeout *t; tmpRegion = XCreateRegion (); if (!tmpRegion) { fprintf (stderr, "%s: Couldn't create region\n", programName); return; } ufd.fd = ConnectionNumber (display->display); ufd.events = POLLIN; for (;;) { if (display->dirtyPluginList) updatePlugins (display); if (restartSignal) { execvp (programName, programArgv); exit (1); } while (XPending (display->display)) { XNextEvent (display->display, &event); /* translate root window */ if (testMode) { Window root, child; switch (event.type) { case ButtonPress: if (!move) { px = event.xbutton.x; py = event.xbutton.y; move = findWindowAt (display, event.xbutton.window, px, py); if (move) { XRaiseWindow (display->display, move->id); continue; } } case ButtonRelease: move = 0; root = translateToRootWindow (display, event.xbutton.window); XTranslateCoordinates (display->display, event.xbutton.root, root, event.xbutton.x_root, event.xbutton.y_root, &event.xbutton.x_root, &event.xbutton.y_root, &child); event.xbutton.root = root; break; case KeyPress: case KeyRelease: root = translateToRootWindow (display, event.xkey.window); XTranslateCoordinates (display->display, event.xkey.root, root, event.xkey.x_root, event.xkey.y_root, &event.xkey.x_root, &event.xkey.y_root, &child); event.xkey.root = root; break; case MotionNotify: if (move) { XMoveWindow (display->display, move->id, move->attrib.x + event.xbutton.x - px, move->attrib.y + event.xbutton.y - py); px = event.xbutton.x; py = event.xbutton.y; continue; } root = translateToRootWindow (display, event.xmotion.window); XTranslateCoordinates (display->display, event.xmotion.root, root, event.xmotion.x_root, event.xmotion.y_root, &event.xmotion.x_root, &event.xmotion.y_root, &child); event.xmotion.root = root; default: break; } } /* add virtual modifiers */ switch (event.type) { case ButtonPress: event.xbutton.state |= CompPressMask; event.xbutton.state = realToVirtualModMask (display, event.xbutton.state); break; case ButtonRelease: event.xbutton.state |= CompReleaseMask; event.xbutton.state = realToVirtualModMask (display, event.xbutton.state); break; case KeyPress: event.xkey.state |= CompPressMask; event.xkey.state = realToVirtualModMask (display, event.xkey.state); break; case KeyRelease: event.xkey.state |= CompReleaseMask; event.xkey.state = realToVirtualModMask (display, event.xkey.state); break; case MotionNotify: event.xmotion.state = realToVirtualModMask (display, event.xmotion.state); break; default: break; } (*display->handleEvent) (display, &event); } if (s->allDamaged || REGION_NOT_EMPTY (s->damage)) { if (timeToNextRedraw == 0) { /* wait for X drawing requests to finish glXWaitX (); */ gettimeofday (&tv, 0); timeDiff = TIMEVALDIFF (&tv, &s->lastRedraw); (*s->preparePaintScreen) (s, timeDiff); if (s->allDamaged) { EMPTY_REGION (s->damage); s->allDamaged = 0; (*s->paintScreen) (s, &defaultScreenPaintAttrib, &defaultWindowPaintAttrib, &s->region, PAINT_SCREEN_REGION_MASK | PAINT_SCREEN_FULL_MASK); glXSwapBuffers (s->display->display, s->root); } else { XIntersectRegion (s->damage, &s->region, tmpRegion); EMPTY_REGION (s->damage); if ((*s->paintScreen) (s, &defaultScreenPaintAttrib, &defaultWindowPaintAttrib, tmpRegion, PAINT_SCREEN_REGION_MASK)) { BoxPtr pBox; int nBox, y; glEnable (GL_SCISSOR_TEST); glDrawBuffer (GL_FRONT); pBox = tmpRegion->rects; nBox = tmpRegion->numRects; while (nBox--) { y = s->height - pBox->y2; glBitmap (0, 0, 0, 0, pBox->x1 - s->rasterX, y - s->rasterY, NULL); s->rasterX = pBox->x1; s->rasterY = y; glScissor (pBox->x1, y, pBox->x2 - pBox->x1, pBox->y2 - pBox->y1); glCopyPixels (pBox->x1, y, pBox->x2 - pBox->x1, pBox->y2 - pBox->y1, GL_COLOR); pBox++; } glDrawBuffer (GL_BACK); glDisable (GL_SCISSOR_TEST); glFlush (); } else { (*s->paintScreen) (s, &defaultScreenPaintAttrib, &defaultWindowPaintAttrib, &s->region, PAINT_SCREEN_FULL_MASK); glXSwapBuffers (s->display->display, s->root); } } s->lastRedraw = tv; (*s->donePaintScreen) (s); /* remove destroyed windows */ while (s->pendingDestroys) { CompWindow *w; for (w = s->windows; w; w = w->next) { if (w->destroyed) { addWindowDamage (w); removeWindow (w); break; } } s->pendingDestroys--; } } timeToNextRedraw = getTimeToNextRedraw (s, &s->lastRedraw); if (timeToNextRedraw) timeToNextRedraw = poll (&ufd, 1, timeToNextRedraw); } else { if (timeouts) { if (timeouts->left > 0) poll (&ufd, 1, timeouts->left); gettimeofday (&tv, 0); timeDiff = TIMEVALDIFF (&tv, &lastTimeout); for (t = timeouts; t; t = t->next) t->left -= timeDiff; while (timeouts && timeouts->left <= 0) { t = timeouts; if ((*t->callBack) (t->closure)) { timeouts = t->next; addTimeout (t); } else { timeouts = t->next; free (t); } } s->lastRedraw = lastTimeout = tv; } else { poll (&ufd, 1, 1000); gettimeofday (&s->lastRedraw, 0); } /* just redraw immediately */ timeToNextRedraw = 0; } } }
/** * @internal * @brief Draws the app for one frame, used by main loop (see drawApp()) */ void Application::drawOneFrame() { // Store elapsed from timers elapsedMicros = m_timer.getMicroseconds(); elapsedMillis = m_timer.getMilliseconds(); elapsedSec = elapsedMicros / 1000000.0; // security against negative elapsed (can come from thread related issues) if ( elapsedMicros < 0 ) elapsedMicros = 1000; if ( elapsedMillis < 0 ) elapsedMillis = 1; if ( elapsedSec < 0 ) elapsedSec = 0.001; secFromStart = m_absTimer.getMicroseconds() / 1000000.0; millisFromStart = m_absTimer.getMilliseconds(); m_timer.reset(); // Update input manager InputManager::getSingleton().update(); // Update plugins that require it at this point updatePlugins( UPDATE_BEFORE_USER ); // Draw user app if (m_loop) { if ( m_userApp ) m_userApp->draw(); else draw(); } // Update plugins that require it at this point updatePlugins( UPDATE_AFTER_USER ); // Draw user app one time if the user calls redraw() function if (m_needUpdate) { updatePlugins( UPDATE_BEFORE_USER ); if ( m_userApp ) m_userApp->draw(); else draw(); updatePlugins( UPDATE_AFTER_USER ); m_needUpdate = false; } // Update physics //PhysicsManager::getSingleton().update( elapsedMillis ); // Update rendering GraphicsManager::getSingleton().draw(); // Update plugins that require it at this point updatePlugins( UPDATE_AFTER_RENDER ); // Update sound()??? // Update frameCount m_frameCount++; frameCount = getFrameCount(); // Check if we need have a forced frame rate if ( m_forcedFrameRate != 0 ) { if ( millisFromStart < (m_timePerFrameMillis * frameCount) ) { unsigned long millisToSleep = (unsigned long)((m_timePerFrameMillis * frameCount) - millisFromStart); if ( millisToSleep > 0 ) pt::psleep( millisToSleep ); } /* m_accumulatedMicros = 0; if ( elapsedMillis < ( m_timePerFrameMillis + m_accumulatedMicros ) ) { unsigned long sleepMillis = (m_timePerFrameMillis + m_accumulatedMicros) - elapsedMillis; //div_t result = div( sleepMicros, 1000 ); //unsigned long sleepMillis = result.quot; //m_accumulatedMicros = 0; //result.rem; if ( sleepMillis > 0 ) { pt::psleep( sleepMillis ); } } */ } }