void XDesktopContainer::exeCurrentAction(XIcon * icon) { if (actionConfig->getReload()->isOccuring(currentAction)){ app->restartIdesk(); } if (actionConfig->getLock()->isOccuring(currentAction)) { toggleLock(); DesktopConfig * dConfig = dynamic_cast<DesktopConfig *>(config); dConfig->saveLockState(locked); } if (icon) //make sure icon is not NULL { if (actionConfig->getDrag()->isOccuring(currentAction) && !isLocked() && !icon->isDragging() ) //only start drag if not already occuring icon->dragButtonPress(event); else if (actionConfig->getEndDrag()->isOccuring(currentAction)) icon->dragButtonRelease(event); for (int i = 0; i < icon->getCommandArray().size() && i < actionConfig->getExecuteActions().size(); i++) if (actionConfig->getExecuteAction(i)->isOccuring(currentAction)){ #ifdef HAVE_STARTUP_NOTIFICATION if (sn_display != NULL) { sn_context = sn_launcher_context_new (sn_display, DefaultScreen (display)); if ((sn_context != NULL) && !sn_launcher_context_get_initiated (sn_context)) { sn_launcher_context_set_name (sn_context, icon->getCommand(i).c_str()); sn_launcher_context_set_description (sn_context, icon->getCommand(i).c_str()); sn_launcher_context_set_binary_name (sn_context, icon->getCommand(i).c_str()); sn_launcher_context_set_icon_name(sn_context, icon->getCommand(i).c_str()); sn_launcher_context_initiate (sn_context, icon->getCommand(i).c_str(), icon->getCommand(i).c_str(), event.xproperty.time); } } #endif /*HAVE_STARTUP_NOTIFICATION */ runCommand(icon->getCommand(i)); } } }
void ActivityManager::initExtenderItem(Plasma::ExtenderItem *item) { // create the widget QGraphicsWidget *widget = new QGraphicsWidget(this); // TODO: use the size of the longest activity name widget->setPreferredWidth(350); // create the layout QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(widget); layout->setOrientation(Qt::Vertical); widget->setLayout(layout); // set up the widget item->setWidget(widget); // create a lock/unlock action toggleLockAction = new QAction(item); toggleLockAction->setIcon(KIcon("object-locked")); toggleLockAction->setEnabled(true); toggleLockAction->setVisible(true); toggleLockAction->setToolTip(i18n("Activities are unlocked. Click to lock.")); item->addAction("toggleLock", toggleLockAction); connect(toggleLockAction, SIGNAL(triggered()), this, SLOT(toggleLock())); }
void MainWindow::setupActions() { // Game KStandardGameAction::gameNew(this, SLOT(startNewGame()), actionCollection()); m_pauseAction = KStandardGameAction::pause(this, SLOT(pauseGame(bool)), actionCollection()); connect(Kg::difficulty(), &KgDifficulty::gameRunningChanged, m_pauseAction, &QAction::setEnabled); QAction *action = KStandardGameAction::solve(m_view, SLOT(solve()), actionCollection()); connect(Kg::difficulty(), &KgDifficulty::gameRunningChanged, action, &QAction::setEnabled); KStandardGameAction::highscores(this, SLOT(showHighscores()), actionCollection()); KStandardGameAction::quit(this, SLOT(close()), actionCollection()); // Settings KStandardAction::preferences(this, SLOT(configureSettings()), actionCollection()); action = new QAction(i18n("&Unlock All"), this); connect(action, SIGNAL(triggered()), m_view->rootObject(), SLOT(unlockAll())); connect(Kg::difficulty(), &KgDifficulty::gameRunningChanged, action, &QAction::setEnabled); actionCollection()->addAction( QStringLiteral( "unlock_all" ), action); action = new QAction(i18n("Keyboard: Field right"), this); actionCollection()->setDefaultShortcut(action, Qt::Key_Right); connect(action, SIGNAL(triggered()), m_view->rootObject(), SLOT(kbGoRight())); actionCollection()->addAction( QStringLiteral( "kb_go_right" ), action); action = new QAction(i18n("Keyboard: Field left"),this); actionCollection()->setDefaultShortcut(action, Qt::Key_Left); connect(action, SIGNAL(triggered()), m_view->rootObject(), SLOT(kbGoLeft())); actionCollection()->addAction( QStringLiteral( "kb_go_left" ), action); action = new QAction(i18n("Keyboard: Field up"),this); actionCollection()->setDefaultShortcut(action, Qt::Key_Up); connect(action, SIGNAL(triggered()), m_view->rootObject(), SLOT(kbGoUp())); actionCollection()->addAction( QStringLiteral( "kb_go_up" ), action); action = new QAction(i18n("Keyboard: Field down"),this); actionCollection()->setDefaultShortcut(action, Qt::Key_Down); connect(action, SIGNAL(triggered()), m_view->rootObject(), SLOT(kbGoDown())); actionCollection()->addAction( QStringLiteral( "kb_go_down" ), action); action = new QAction(i18n("Keyboard: Turn clockwise"),this); actionCollection()->setDefaultShortcut(action, Qt::Key_Return); connect(action, SIGNAL(triggered()), m_view->rootObject(), SLOT(rotateClockwise())); actionCollection()->addAction( QStringLiteral( "kb_turn_clockwise" ), action); action = new QAction(i18n("Keyboard: Turn counterclockwise"),this); actionCollection()->setDefaultShortcut(action, Qt::CTRL + Qt::Key_Return); connect(action, SIGNAL(triggered()), m_view->rootObject(), SLOT(rotateCounterclockwise())); actionCollection()->addAction( QStringLiteral( "kb_turn_counterclockwise" ), action); action = new QAction(i18n("Keyboard: Toggle lock"),this); actionCollection()->setDefaultShortcut(action, Qt::Key_Space); connect(action, SIGNAL(triggered()), m_view->rootObject(), SLOT(toggleLock())); actionCollection()->addAction( QStringLiteral( "kb_lock" ), action); }
Window::Window(testApp * _app) { QWidget * content = new QWidget(); ofApp = _app; // tab = new QTabWidget; viewCombo = new QComboBox(); glWidget = new GLWidget(ofApp); glWidget->setFixedWidth(500); glWidget->setFixedHeight(500); // content->setFixedWidth(500); // content->setFixedHeight(500); glWidget->viewCombo = viewCombo; QTimer *timer = new QTimer(this); timer->setInterval(20); QObject::connect(timer, SIGNAL(timeout()), glWidget, SLOT(update())); QObject::connect(timer, SIGNAL(timeout()), glWidget, SLOT(updateGL())); timer->start(); setWindowTitle(tr("Illutron Robot")); QTimer *settingsTimer = new QTimer(this); settingsTimer->setInterval(1000); QObject::connect(settingsTimer, SIGNAL(timeout()), this, SLOT(saveSettings())); settingsTimer->start(); //GENERAL SETTINGS TAB QLabel *fpsLabel = new QLabel(tr("FPS")); QWidget *settingsGroupBox = new QWidget(); QGridLayout *settingsGrid = new QGridLayout; settingsGrid->setAlignment(Qt::AlignTop); settingsGrid->addWidget(new QLabel(tr("FPS:")), 0, 0); settingsGrid->addWidget(fpsLabel, 0,1); settingsGrid->setColumnStretch(1,20); settingsGroupBox->setLayout(settingsGrid); //tab->addTab(settingsGroupBox, "General"); /* QDockWidget *dockWidget = new QDockWidget(tr("General"), this); dockWidget->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); dockWidget->setWidget(settingsGroupBox);*/ //addDockWidget(Qt::RightDockWidgetArea, dockWidget); setTabPosition(Qt::RightDockWidgetArea,QTabWidget::East); //SETUP MAIN LAYOUT QHBoxLayout *mainLayout = new QHBoxLayout; QWidget *glGroupBox = new QWidget(); QVBoxLayout *glLayout = new QVBoxLayout; glGroupBox->setLayout(glLayout); glLayout->addWidget(viewCombo); glLayout->addWidget(glWidget); glLayout->setAlignment(Qt::AlignTop); mainLayout->addWidget(glGroupBox); // mainLayout->addWidget(tab); content->setLayout(mainLayout); setCentralWidget(content); //GENERAL EVENT CONNECTIONS //connect(xSlider, SIGNAL(valueChanged(int)), glWidget, SLOT(setXRotation(int))); //This line connects the x slider to the testApp // connect(rotateSlider, SIGNAL(valueChanged(int)), glWidget, SLOT(setRotateSlider(int))); connect(glWidget, SIGNAL(frameRateChanged(double)), fpsLabel, SLOT(setNum(double))); //connect(tabLayout, SIGNAL(valueChanged(int)), glWidget, SLOT(setXRotation(int))); settings = new QSettings("BrandtsRobot", "Illutron"); setUnifiedTitleAndToolBarOnMac(true); lock = new QAction(QIcon(QString(ofToDataPath("lock.png", true).c_str())), tr("Lock"),this); lock->setShortcut( QKeySequence(Qt::ControlModifier + Qt::Key_L)); QObject::connect(lock, SIGNAL(triggered()), this, SLOT(toggleLock())); toolbar = addToolBar(tr("Toolbar")); setIconSize(QSize(20,20)); toolbar->addAction(lock); statusBar()->showMessage(tr("Locked")); setDockOptions(QMainWindow::AnimatedDocks | QMainWindow::AllowTabbedDocks | QMainWindow::AllowNestedDocks); }
void RequestModule::serveRequest(Request request, Input input_parameters[INPUT_PARAMETER_MAX_COUNT]) { // Authorizes the request if(! SecurityModule::authorizeRequest(request, input_parameters)) { // The request has not been authorized CommunicationModule::sendErrorResponse(UNAUTHORIZED); return; } // Serves the request switch(request) { case ADD_USER : { addUser(input_parameters[1], input_parameters[2]); break; } case CHANGE_PASSWORD : { changePassword(input_parameters[0], input_parameters[1]); break; } case LOGIN : { login(input_parameters[0], input_parameters[1]); break; } case LOGOUT : { logout(input_parameters[0]); break; } case REFRESH_TTL : { refreshTtl(input_parameters[0]); break; } case REMOVE_USER : { removeUser(input_parameters[1]); break; } case REQUEST_STATE : { requestState(); break; } case REQUEST_USERS : { requestUsers(); break; } case TOGGLE_LIGHT : { toggleLight(); break; } case TOGGLE_LOCK : { toggleLock(); break; } } }