Exemplo n.º 1
0
	//==========================================================================
	bool Finalise(IComponentContext& contextManager) override
	{
		projectManager_.getBase<ProjectManager>()->fini();
		projectManager_ = nullptr;
		auto uiApplication = contextManager.queryInterface<IUIApplication>();
		assert(uiApplication != nullptr);
		uiApplication->removeAction(*newProject_);
		uiApplication->removeAction(*openProject_);
		uiApplication->removeAction(*saveProject_);
		uiApplication->removeAction(*closeProject_);
		if (newProjectDialog_ != nullptr)
		{
			uiApplication->removeWindow(*newProjectDialog_);
			newProjectDialog_ = nullptr;
		}
		if (openProjectDialog_ != nullptr)
		{
			uiApplication->removeWindow(*openProjectDialog_);
			openProjectDialog_ = nullptr;
		}
		connections_.clear();
		newProject_ = nullptr;
		openProject_ = nullptr;
		saveProject_ = nullptr;
		closeProject_ = nullptr;
		return true;
	}
Exemplo n.º 2
0
void Breadcrumb::popAction()
{
    QList<QAction*> actions = this->actions();
    if (actions.isEmpty())
        return;

    removeAction(actions.last());

    // remove separators; 2 because the last one has been removed
    for (int n = actions.length() - 2; n >= 0; --n) {
        if (actions[n]->isSeparator())
            removeAction(actions[n]);
        break;
    }

    // convert last action to current
    actions = this->actions();
    if (actions.isEmpty())
        return;
    QString text = actions.last()->text();
    removeAction(actions.last());
    addCurrent(text);

    actions = this->actions();
    if (actions.length() == 1) { // only the last Top item
        removeAction(actions[0]);
        setVisible(false);
    }
}
Exemplo n.º 3
0
void MainWindow::setCustomSoftKeys()
{
    if (toggleButton->isChecked()) {
        infoLabel->setText(tr("Custom softkeys set"));
        addSoftKeys();
        }
    else {
        infoLabel->setText(tr("Custom softkeys removed"));
        removeAction(ok);
        removeAction(cancel);
    }
}
Exemplo n.º 4
0
void TtoolBar::setAfterAnswer() {
	removeAction(checkAct);
	if (repeatSndAct) {
		removeAction(repeatSndAct);
#if defined (Q_OS_ANDROID)
    flyActions()->removeOne(repeatSndAct);
#endif
  }
	if (tuneForkAct) {
		removeAction(tuneForkAct);
#if defined (Q_OS_ANDROID)
    flyActions()->removeOne(tuneForkAct);
#endif
  }
}
Exemplo n.º 5
0
void QLCFixtureEditor::slotChannelListContextMenuRequested()
{
    QAction editAction(QIcon(":/edit.png"), tr("Edit"), this);
    QAction copyAction(QIcon(":/editcopy.png"), tr("Copy"), this);
    QAction pasteAction(QIcon(":/editpaste.png"), tr("Paste"), this);
    QAction removeAction(QIcon(":/editdelete.png"), tr("Remove"), this);

    /* Group menu */
    QMenu groupMenu;
    groupMenu.setTitle("Set group");
    QStringListIterator it(QLCChannel::groupList());
    while (it.hasNext() == true)
        groupMenu.addAction(it.next());

    /* Master edit menu */
    QMenu menu;
    menu.setTitle(tr("Channels"));
    menu.addAction(&editAction);
    menu.addAction(&copyAction);
    menu.addAction(&pasteAction);
    menu.addSeparator();
    menu.addAction(&removeAction);
    menu.addSeparator();
    menu.addMenu(&groupMenu);

    if (m_channelList->currentItem() == NULL)
    {
        copyAction.setEnabled(false);
        removeAction.setEnabled(false);
    }

    if (_app->copyChannel() == NULL)
        pasteAction.setEnabled(false);

    QAction* selectedAction = menu.exec(QCursor::pos());
    if (selectedAction == NULL)
        return;
    else if (selectedAction->text() == tr("Edit"))
        slotEditChannel();
    else if (selectedAction->text() == tr("Copy"))
        slotCopyChannel();
    else if (selectedAction->text() == tr("Paste"))
        slotPasteChannel();
    else if (selectedAction->text() == tr("Remove"))
        slotRemoveChannel();
    else
    {
        /* Group menu hook */
        QLCChannel* ch = NULL;
        QTreeWidgetItem* node = NULL;

        ch = currentChannel();
        if (ch != NULL)
            ch->setGroup(QLCChannel::stringToGroup(selectedAction->text()));
        node = m_channelList->currentItem();
        if (node != NULL)
            node->setText(CH_COL_GRP, selectedAction->text());
        setModified();
    }
}
Exemplo n.º 6
0
SelectActionTest::SelectActionTest(QWidget *parent)
    : KXmlGuiWindow(parent)
    , m_comboSelect(new KSelectAction("Combo Selection", this))
    , m_buttonSelect(new KSelectAction("Button Selection", this))
{
    actionCollection()->addAction("combo", m_comboSelect);
    actionCollection()->addAction("button", m_buttonSelect);
    for (int i = 0; i < 7; ++i) {
      QAction* action = m_comboSelect->addAction(QString ("Combo Action %1").arg(i));
      connect(action, SIGNAL(triggered(bool)), SLOT(slotActionTriggered(bool)));
      action = m_buttonSelect->addAction(QString ("Action %1").arg(i));
      connect(action, SIGNAL(triggered(bool)), SLOT(slotActionTriggered(bool)));
    }

    m_comboSelect->setToolBarMode(KSelectAction::ComboBoxMode);
    m_comboSelect->setWhatsThis("What's this?");
    connect(m_comboSelect, SIGNAL(triggered(QAction*)), SLOT(triggered(QAction*)));
    connect(m_comboSelect, SIGNAL(triggered(int)), SLOT(triggered(int)));
    connect(m_comboSelect, SIGNAL(triggered(const QString&)), SLOT(triggered(const QString&)));

    m_buttonSelect->setToolBarMode(KSelectAction::MenuMode);
    m_buttonSelect->setWhatsThis("What's this?");
    connect(m_buttonSelect, SIGNAL(triggered(QAction*)), SLOT(triggered(QAction*)));
    connect(m_buttonSelect, SIGNAL(triggered(int)), SLOT(triggered(int)));
    connect(m_buttonSelect, SIGNAL(triggered(const QString&)), SLOT(triggered(const QString&)));

    menuBar()->addAction(m_comboSelect);
    menuBar()->addAction(m_buttonSelect);
    menuBar()->addAction("Add an action", this, SLOT(addAction()));
    menuBar()->addAction("Remove an action", this, SLOT(removeAction()));

    QToolBar* toolBar = addToolBar("Test");
    toolBar->addAction(m_comboSelect);
    toolBar->addAction(m_buttonSelect);
}
Exemplo n.º 7
0
void HistoryDialog::contextMenu(QPoint point)
{
  mContextIndex = ui->tableView->indexAt(point);;

  QMenu contextMenu(ui->tableView);

  QAction copyAction((mContextIndex.column() == 0) ? tr("Copy Path") : tr("Copy URL"), &contextMenu);
  connect(&copyAction, SIGNAL(triggered()), this, SLOT(copy()));
  contextMenu.addAction(&copyAction);

  QAction deleteAction(tr("Delete from imgur.com"), &contextMenu);
  QAction locationAction(tr("Open Location"), &contextMenu);

  QAction removeAction(tr("Remove history entry"), &contextMenu);

  if (mContextIndex.data().toString().isEmpty()) {
    copyAction.setEnabled(false);
    deleteAction.setEnabled(false);
  }

  if (mContextIndex.column() == 0) {
    connect(&locationAction, SIGNAL(triggered()), this, SLOT(location()));
    contextMenu.addAction(&locationAction);
  }
  else {
    connect(&deleteAction, SIGNAL(triggered()), this, SLOT(deleteImage()));
    contextMenu.addAction(&deleteAction);
  }

  connect(&removeAction, SIGNAL(triggered()), this, SLOT(removeHistoryEntry()));
  contextMenu.addAction(&removeAction);
  contextMenu.exec(QCursor::pos());
}
Exemplo n.º 8
0
CoverArtLabel::~CoverArtLabel()
{
    QList< QAction* > artActions = actions();
    foreach( QAction *act, artActions )
        removeAction( act );
    if ( p_item ) input_item_Release( p_item );
}
Exemplo n.º 9
0
void BACIComponent::removeCallbackAndAction(int callbackID)
{
  ACS_TRACE("baci::BACIComponent::removeCallbackAndAction");

  removeAction(callbackID);
  removeCallback(callbackID);
}
Exemplo n.º 10
0
void MessageWidget::removeAllActions()
{
     QList<QAction *> acts=actions();
     for (QAction *a: acts) {
         removeAction(a);
     }
}
Exemplo n.º 11
0
void QtDockRegion::removeView(IView& view)
{
	auto qMainWindow = qtWindow_.window();
	if (qMainWindow == nullptr)
	{
		return;
	}

	auto findIt = dockWidgetMap_.find(&view);
	if (findIt == dockWidgetMap_.end())
	{
		return;
	}

	// TODO: save dockWidget state
	auto dockWidget = std::move(findIt->second.first);
	auto action = std::move(findIt->second.second);
	dockWidgetMap_.erase(findIt);

	auto application = get<IUIApplication>();
	assert(application != nullptr);
	application->removeAction(*action);
	action = nullptr;

	assert(dockWidget != nullptr);
	dockWidget->setWidget(nullptr);
	qMainWindow->removeDockWidget(dockWidget.get());
	// call this function to let IView control the qWidget's life-cycle again.
	auto qtFramework = get<IQtFramework>();
	assert(qtFramework != nullptr);
	qtFramework->retainQWidget(view);
	dockWidget = nullptr;
}
Exemplo n.º 12
0
void WindowMenu::onAboutToShow()
{
   QWidget* win = QApplication::activeWindow();
   pMinimize_->setEnabled(win);
   pZoom_->setEnabled(win && win->maximumSize() != win->minimumSize());
   pBringAllToFront_->setEnabled(win);


   for (int i = windows_.size() - 1; i >= 0; i--)
   {
      QAction* pAction = windows_[i];
      removeAction(pAction);
      windows_.removeAt(i);
      pAction->deleteLater();
   }

   QWidgetList topLevels = QApplication::topLevelWidgets();
   for (int i = 0; i < topLevels.size(); i++)
   {
      QWidget* pWindow = topLevels.at(i);
      if (!pWindow->isVisible())
         continue;

      QAction* pAction = new QAction(pWindow->windowTitle(), pWindow);
      pAction->setData(QVariant::fromValue(pWindow));
      pAction->setCheckable(true);
      if (pWindow->isActiveWindow())
         pAction->setChecked(true);
      insertAction(pWindowPlaceholder_, pAction);
      connect(pAction, SIGNAL(triggered()),
              this, SLOT(showWindow()));

      windows_.append(pAction);
   }
}
Exemplo n.º 13
0
bool HistoryChatView::onContextMenu(ChatView *view, QMenu *menu, const QWebHitTestResult &result)
{
  ChatId id(view->id());
  if (id.type() != ChatId::ChannelId && id.type() != ChatId::UserId)
    return false;

  const QWebElement block = result.enclosingBlockElement();
  if (!block.hasClass("blocks") || block.hasClass("removed"))
    return false;

  const QWebElement container = block.parent();
  const qint64 mdate          = container.attribute(LS("data-mdate")).toLongLong();

  if (!mdate)
    return false;

  id.init(container.attribute(LS("id")).toLatin1());
  id.setDate(mdate);
  if (id.type() != ChatId::MessageId)
    return false;

  const int permissions = this->permissions(HistoryDB::get(id));
  if (permissions == NoPermissions)
    return false;

  if (permissions & Remove) {
    QVariantList data;
    data << view->id() << (id.hasOid() ? ChatId::toBase32(id.oid().byteArray()) : id.toString());

    menu->insertAction(menu->actions().first(), removeAction(data));
  }
  return true;
}
Exemplo n.º 14
0
// --------------------------------------------------------------------------------------------------------
void KikiEvent::removeAllActions ()
{
    while (actions.empty() == false)
    {
        removeAction(actions.back());
    }
}
Exemplo n.º 15
0
void LayerAclMenu::rowsRemoved(const QModelIndex &parent, int start, int end)
{
	Q_UNUSED(parent);
	for(int i=start;i<=end;++i) {
		removeAction(_users.takeAt(start));
	}
}
Exemplo n.º 16
0
CoverArtLabel::~CoverArtLabel()
{
    QList< QAction* > artActions = actions();
    foreach( QAction *act, artActions )
        removeAction( act );
    if ( p_item ) vlc_gc_decref( p_item );
}
Exemplo n.º 17
0
void QLCFixtureEditor::slotModeListContextMenuRequested()
{
    QAction editAction(QIcon(":/edit.png"), tr("Edit"), this);
    connect(&editAction, SIGNAL(triggered(bool)),
            this, SLOT(slotEditMode()));
    QAction cloneAction(QIcon(":/editcopy.png"), tr("Clone"), this);
    connect(&cloneAction, SIGNAL(triggered(bool)),
            this, SLOT(slotCloneMode()));
    QAction removeAction(QIcon(":/editdelete.png"), tr("Remove"), this);
    connect(&removeAction, SIGNAL(triggered(bool)),
            this, SLOT(slotRemoveMode()));

    QMenu menu;
    menu.setTitle(tr("Modes"));
    menu.addAction(&editAction);
    menu.addAction(&cloneAction);
    menu.addSeparator();
    menu.addAction(&removeAction);

    if (m_modeList->currentItem() == NULL)
    {
        editAction.setEnabled(false);
        cloneAction.setEnabled(false);
        removeAction.setEnabled(false);
    }

    menu.exec(QCursor::pos());
}
Exemplo n.º 18
0
void DisassemblyView::showContextMenu(QPoint const & pos)
{
  QMenu menu;
  QPoint globalPos = viewport()->mapToGlobal(pos);

  medusa::Address CurAddr;
  std::list<QAction *> DynActs;
  if (convertPositionToAddress(pos, CurAddr))
  {
    auto SpecActions = medusa::Action::GetSpecificActions(*_core, CurAddr);
    for (auto spAct : SpecActions)
    {
      auto pUiAct = new UiAction(this, spAct, QKeySequence(), this);
      addAction(pUiAct);
      DynActs.push_back(pUiAct);
    }
  }

  menu.addActions(actions());
  menu.exec(globalPos);

  for (auto pAct : DynActs)
  {
    removeAction(pAct);
    delete pAct;
  }
}
Exemplo n.º 19
0
// main loop
void CCActionManager::update(float dt)
{
    dt = 1/60.0f;
    for (tHashElement *elt = m_pTargets; elt != NULL; )
    {
        m_pCurrentTarget = elt;
        m_bCurrentTargetSalvaged = false;

        if (! m_pCurrentTarget->paused)
        {
            // The 'actions' CCMutableArray may change while inside this loop.
            for (m_pCurrentTarget->actionIndex = 0; m_pCurrentTarget->actionIndex < m_pCurrentTarget->actions->num;
                m_pCurrentTarget->actionIndex++)
            {
                m_pCurrentTarget->currentAction = (CCAction*)m_pCurrentTarget->actions->arr[m_pCurrentTarget->actionIndex];
                if (m_pCurrentTarget->currentAction == NULL)
                {
                    continue;
                }

                m_pCurrentTarget->currentActionSalvaged = false;

                m_pCurrentTarget->currentAction->step(dt);

                if (m_pCurrentTarget->currentActionSalvaged)
                {
                    // The currentAction told the node to remove it. To prevent the action from
                    // accidentally deallocating itself before finishing its step, we retained
                    // it. Now that step is done, it's safe to release it.
                    m_pCurrentTarget->currentAction->release();
                } else
                if (m_pCurrentTarget->currentAction->isDone())
                {
                    m_pCurrentTarget->currentAction->stop();

                    CCAction *pAction = m_pCurrentTarget->currentAction;
                    // Make currentAction nil to prevent removeAction from salvaging it.
                    m_pCurrentTarget->currentAction = NULL;
                    removeAction(pAction);
                }

                m_pCurrentTarget->currentAction = NULL;
            }
        }

        // elt, at this moment, is still valid
        // so it is safe to ask this here (issue #490)
        elt = (tHashElement*)(elt->hh.next);

        // only delete currentTarget if no actions were scheduled during the cycle (issue #481)
        if (m_bCurrentTargetSalvaged && m_pCurrentTarget->actions->num == 0)
        {
            deleteHashElement(m_pCurrentTarget);
        }
    }

    // issue #635
    m_pCurrentTarget = NULL;
}
Exemplo n.º 20
0
GVariant* GnomeGrabber::Impl::onShellMethodCall(std::string const& method, GVariant* parameters)
{
  LOG_DEBUG(logger) << "Called method '" << method << "'";

  if (method == "GrabAccelerators")
  {
    if (g_variant_is_of_type(parameters, G_VARIANT_TYPE("(a(su))")))
    {
      GVariant* variant;
      GVariantBuilder builder;
      GVariantIter* iterator;
      gchar const* accelerator;
      guint flags;

      g_variant_builder_init(&builder, G_VARIANT_TYPE("au"));
      g_variant_get(parameters, "(a(su))", &iterator);

      while (g_variant_iter_next(iterator, "(&su)", &accelerator, &flags))
        g_variant_builder_add(&builder, "u", grabAccelerator(accelerator, flags));

      g_variant_iter_free(iterator);
      variant = g_variant_builder_end(&builder);
      return g_variant_new_tuple(&variant, 1);
    }
    else
      LOG_WARN(logger) << "Expected arguments of type (a(su))";
  }
  else if (method == "GrabAccelerator")
  {
    if (g_variant_is_of_type(parameters, G_VARIANT_TYPE("(su)")))
    {
      GVariant* variant;
      gchar const* accelerator;
      guint flags;

      g_variant_get(parameters, "(&su)", &accelerator, &flags);
      variant = g_variant_new_uint32(grabAccelerator(accelerator, flags));
      return g_variant_new_tuple(&variant, 1);
    }
    else
      LOG_WARN(logger) << "Expected arguments of type (su)";
  }
  else if (method == "UngrabAccelerator")
  {
    if (g_variant_is_of_type(parameters, G_VARIANT_TYPE("(u)")))
    {
      GVariant* variant;
      guint action;

      g_variant_get(parameters, "(u)", &action);
      variant = g_variant_new_boolean(removeAction(action));
      return g_variant_new_tuple(&variant, 1);
    }
    else
      LOG_WARN(logger) << "Expected arguments of type (u)";
  }

  return nullptr;
}
Exemplo n.º 21
0
Arquivo: toolbar.cpp Projeto: BGmot/Qt
void ToolBar::removeSpinBox()
{
    if (spinboxAction)
        removeAction(spinboxAction);

    addSpinBoxAction->setEnabled(true);
    removeSpinBoxAction->setEnabled(false);
}
Exemplo n.º 22
0
void TtoolBar::setForQuestion(bool repeatSound, bool tuneFork) {
	removeAction(nextQuestAct);
	removeAction(prevQuestAct);
	if (repeatSound && repeatSndAct) {
		addAction(repeatSndAct);
#if defined (Q_OS_ANDROID)
    flyActions()->append(repeatSndAct);
#endif
  }
	if (tuneFork && tuneForkAct) {
		addAction(tuneForkAct);
#if defined (Q_OS_ANDROID)
    flyActions()->append(tuneForkAct);
#endif
  }
	addAction(checkAct);
}
Exemplo n.º 23
0
void CMegaMenu::switchState()
{
    QList<QAction *> acts = QWidget::actions();
    QAction * act;
    foreach(act,acts)
    {
        removeAction(act);
    }
Exemplo n.º 24
0
// main loop
void ActionManager::update(float dt)
{
    for (tHashElement *elt = _targets; elt != nullptr; )
    {
        _currentTarget = elt;
        _currentTargetSalvaged = false;

        if (! _currentTarget->paused)
        {
            // The 'actions' MutableArray may change while inside this loop.
            for (_currentTarget->actionIndex = 0; _currentTarget->actionIndex < _currentTarget->actions->num;
                _currentTarget->actionIndex++)
            {
                _currentTarget->currentAction = (Action*)_currentTarget->actions->arr[_currentTarget->actionIndex];
                if (_currentTarget->currentAction == nullptr)
                {
                    continue;
                }

                _currentTarget->currentActionSalvaged = false;

                _currentTarget->currentAction->step(dt);

                if (_currentTarget->currentActionSalvaged)
                {
                    // The currentAction told the node to remove it. To prevent the action from
                    // accidentally deallocating itself before finishing its step, we retained
                    // it. Now that step is done, it's safe to release it.
                    _currentTarget->currentAction->release();
                } else
                if (_currentTarget->currentAction->isDone())
                {
                    _currentTarget->currentAction->stop();

                    Action *action = _currentTarget->currentAction;
                    // Make currentAction nil to prevent removeAction from salvaging it.
                    _currentTarget->currentAction = nullptr;
                    removeAction(action);
                }

                _currentTarget->currentAction = nullptr;
            }
        }

        // elt, at this moment, is still valid
        // so it is safe to ask this here (issue #490)
        elt = (tHashElement*)(elt->hh.next);

        // only delete currentTarget if no actions were scheduled during the cycle (issue #481)
        if (_currentTargetSalvaged && _currentTarget->actions->num == 0)
        {
            deleteHashElement(_currentTarget);
        }
    }

    // issue #635
    _currentTarget = nullptr;
}
Exemplo n.º 25
0
// --------------------------------------------------------------------------------------------------------
void KikiEvent::removeActionsOfObject ( KikiActionObject * object )
{
    for (KikiActionIter iter = actions.begin(); iter != actions.end(); iter++)
    {	
        if ((*iter)->getObject() == object)
        {
            removeAction(*iter);
        }
    }
}
Exemplo n.º 26
0
// --------------------------------------------------------------------------------------------------------
void KikiEvent::removeActionWithName ( const std::string & actionName )
{
    for (KikiActionIter iter = actions.begin(); iter != actions.end(); iter++)
    {	
        if ((*iter)->getName() == actionName)
        {
            removeAction(*iter);
            return;
        }
    }
}
Exemplo n.º 27
0
/*! @brief Called when the queue is right clicked.

    Connected to the customContextMenuRequested signal from the queue. It creates and displays a menu.
*/
void Queue::provideContextMenu(QPoint p) {
    QTableWidgetItem* item = itemAt(p);
    if (item->column() == 0 && item->row() != 0) {
        rowToRemove = item->row();
        QMenu menu;
        QAction* remove = new QAction("Remove", this);
        connect(remove, SIGNAL(triggered()), this, SLOT(removeAction()));
        menu.addAction(remove);
        menu.exec(QCursor::pos());
    }
}
Exemplo n.º 28
0
void RecentFileMenu::removeRecentFile( QString filename )
{
    if ( mRecentFiles.contains( filename ) )
    {
        QAction *action = mRecentActions.at( filename );
        removeAction( action );

        mRecentActions.erase( filename );
        mRecentFiles.removeOne( filename );
        delete action;
    }
}
Exemplo n.º 29
0
void XxxForm::createActions(void) {
	connect(statusTimer, SIGNAL(timeout()), this, SLOT(timerStatusAction()));

	connect(nextPushButton, SIGNAL(released()), this, SLOT(nextAction()));
	connect(previousPushButton, SIGNAL(released()), this,
			SLOT(previousAction()));

	connect(savePushButton, SIGNAL(released()), this, SLOT(saveAction()));
	connect(saveAndContinueSavingPushButton, SIGNAL(released()), this, SLOT(
			saveAndContinueSavingAction()));
	connect(removePushButton, SIGNAL(released()), this, SLOT(removeAction()));
	connect(cancelPushButton, SIGNAL(released()), this, SLOT(cancelAction()));
}
Exemplo n.º 30
0
void MenuButton::setAction(QAction *action)
{
  _button->disconnect();
  if (!action)
    return;

  if (_action)
    removeAction(_action);
  _action = action;
  addAction(_action);
  connect(_button, SIGNAL(clicked()), _action, SLOT(trigger()));
  setEnabled(_action->isEnabled());
}