Example #1
0
    QMenu *CodeLineEdit::createVariablesMenu(QMenu *parentMenu, bool ignoreMultiline)
    {
        QMenu *variablesMenu = 0;

        if(!ignoreMultiline && isMultiline())
        {
            variablesMenu = new QMenu(tr("Cannot insert in a multiline parameter"), parentMenu);
            variablesMenu->setEnabled(false);
        }
        else
        {
            Q_ASSERT(mParameterContainer);
            variablesMenu = mParameterContainer->createVariablesMenu(parentMenu);
            if(variablesMenu)
            {
                variablesMenu->setTitle(tr("Insert variable"));
            }
            else
            {
                variablesMenu = new QMenu(tr("No variables to insert"), parentMenu);
                variablesMenu->setEnabled(false);
            }
        }

        variablesMenu->setIcon(QIcon(":/images/variable.png"));

        return variablesMenu;
    }
Example #2
0
    QMenu *CodeLineEdit::createResourcesMenu(QMenu *parentMenu, bool ignoreMultiline)
    {
        QMenu *resourceMenu = 0;

        if(!ignoreMultiline && isMultiline())
        {
            resourceMenu = new QMenu(tr("Cannot insert in a multiline parameter"), parentMenu);
            resourceMenu->setEnabled(false);
        }
        else
        {
            Q_ASSERT(mParameterContainer);
            resourceMenu = mParameterContainer->createResourcesMenu(parentMenu);
            if(resourceMenu)
                resourceMenu->setTitle(tr("Insert resource"));
            else
            {
                resourceMenu = new QMenu(tr("No resources to insert"), parentMenu);
                resourceMenu->setEnabled(false);
            }
        }

        resourceMenu->setIcon(QIcon(":/images/resource.png"));

        return resourceMenu;
    }
Example #3
0
void db_x509req::showContextMenu(QContextMenuEvent *e, const QModelIndex &index)
{
	QMenu *menu = new QMenu(mainwin);
	QMenu *subExport;
	currentIdx = index;

	pki_x509req *req = static_cast<pki_x509req*>(index.internalPointer());

	menu->addAction(tr("New Request"), this, SLOT(newItem()));
	menu->addAction(tr("Import"), this, SLOT(load()));
	if (index != QModelIndex()) {
		if (!req->getRefKey())
			menu->addAction(tr("Extract public Key"),
				this, SLOT(extractPubkey()));
		menu->addAction(tr("Rename"), this, SLOT(edit()));
		menu->addAction(tr("Show Details"), this, SLOT(showItem()));
		menu->addAction(tr("Sign"), this, SLOT(signReq()));
		subExport = menu->addMenu(tr("Export"));
		subExport->addAction(tr("Clipboard"), this,
					SLOT(pem2clipboard()));
		subExport->addAction(tr("File"), this, SLOT(store()));
		subExport->addAction(tr("Template"), this, SLOT(toTemplate()));
		subExport->addAction(tr("OpenSSL config"), this,
					SLOT(toOpenssl()));
		menu->addAction(tr("Delete"), this, SLOT(delete_ask()));

		subExport->setEnabled(!req->isSpki());
	}
	contextMenu(e, menu);
	currentIdx = QModelIndex();
	return;
}
Example #4
0
void MainWindow::createMenus()
{
	// Map menu:
	QMenu * file = menuBar()->addMenu(tr("&Map"));
	file->addAction(m_actNewGen);
	file->addAction(m_actOpenGen);
	file->addSeparator();
	QMenu * worlds = file->addMenu(tr("Open &existing"));
	worlds->addActions(m_WorldActions);
	if (m_WorldActions.empty())
	{
		worlds->setEnabled(false);
	}
	file->addAction(m_actOpenWorld);
	file->addSeparator();
	file->addAction(m_actReload);
	file->addSeparator();
	file->addAction(m_actExit);

	// View menu:
	QMenu * view = menuBar()->addMenu(tr("&View"));
	view->addAction(m_actViewCenter);
	view->addSeparator();
	for (size_t i = 0; i < ARRAYCOUNT(m_actViewZoom); i++)
	{
		view->addAction(m_actViewZoom[i]);
	}
}
Example #5
0
/*! Initializes the plugin. Returns true on success.
    Plugins want to register objects with the plugin manager here.

    \a error_message can be used to pass an error message to the plugin system,
       if there was any.
*/
bool HelloWorldPlugin::initialize(const QStringList &arguments, QString *error_message)
{
    Q_UNUSED(arguments)
    Q_UNUSED(error_message)

    // Get the primary access point to the workbench.
    Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>();

    // Create a unique context id for our own view, that will be used for the
    // menu entry later.
    QList<int> context = QList<int>()
        << core->uniqueIDManager()->uniqueIdentifier(
                QLatin1String("HelloWorld.MainView"));

    // Create an action to be triggered by a menu entry
    QAction *helloWorldAction = new QAction("Say \"&Hello World!\"", this);
    connect(helloWorldAction, SIGNAL(triggered()), SLOT(sayHelloWorld()));

    // Register the action with the action manager
    Core::ActionManagerInterface *actionManager = core->actionManager();
    Core::ICommand *command =
            actionManager->registerAction(
                    helloWorldAction, "HelloWorld.HelloWorldAction", context);

    // Create our own menu to place in the Tools menu
    Core::IActionContainer *helloWorldMenu =
            actionManager->createMenu("HelloWorld.HelloWorldMenu");
    QMenu *menu = helloWorldMenu->menu();
    menu->setTitle(tr("&Hello World"));
    menu->setEnabled(true);

    // Add the Hello World action command to the menu
    helloWorldMenu->addAction(command);

    // Request the Tools menu and add the Hello World menu to it
    Core::IActionContainer *toolsMenu =
            actionManager->actionContainer(Core::Constants::M_TOOLS);
    toolsMenu->addMenu(helloWorldMenu);

    // Add a mode with a push button based on BaseMode. Like the BaseView,
    // it will unregister itself from the plugin manager when it is deleted.
    Core::BaseMode *baseMode = new Core::BaseMode;
    baseMode->setUniqueModeName("HelloWorld.HelloWorldMode");
    baseMode->setName(tr("Hello world!"));
    baseMode->setIcon(QIcon());
    baseMode->setPriority(0);
    baseMode->setWidget(new QPushButton(tr("Hello World PushButton!")));
    addAutoReleasedObject(baseMode);

    // Add the Hello World action command to the mode manager (with 0 priority)
    Core::ModeManager *modeManager = core->modeManager();
    modeManager->addAction(command, 0);

    return true;
}
Example #6
0
bool CppToolsPlugin::initialize(const QStringList &arguments, QString *error)
{
    Q_UNUSED(arguments)
    Q_UNUSED(error)

    qRegisterMetaType<CppTools::CppCodeStyleSettings>("CppTools::CppCodeStyleSettings");

    Core::ICore *core = Core::ICore::instance();
    Core::ActionManager *am = core->actionManager();

    m_settings = new CppToolsSettings(this); // force registration of cpp tools settings

    // Objects
    m_modelManager = new CppModelManager(this);
    Core::VcsManager *vcsManager = core->vcsManager();
    Core::FileManager *fileManager = core->fileManager();
    connect(vcsManager, SIGNAL(repositoryChanged(QString)),
            m_modelManager, SLOT(updateModifiedSourceFiles()));
    connect(fileManager, SIGNAL(filesChangedInternally(QStringList)),
            m_modelManager, SLOT(updateSourceFiles(QStringList)));
    addAutoReleasedObject(m_modelManager);

    addAutoReleasedObject(new CppCompletionAssistProvider);
    addAutoReleasedObject(new CppLocatorFilter(m_modelManager));
    addAutoReleasedObject(new CppClassesFilter(m_modelManager));
    addAutoReleasedObject(new CppFunctionsFilter(m_modelManager));
    addAutoReleasedObject(new CppCurrentDocumentFilter(m_modelManager, core->editorManager()));
    addAutoReleasedObject(new CompletionSettingsPage);
    addAutoReleasedObject(new CppFileSettingsPage(m_fileSettings));
    addAutoReleasedObject(new SymbolsFindFilter(m_modelManager));
    addAutoReleasedObject(new CppCodeStyleSettingsPage);

    TextEditor::CodeStylePreferencesManager::instance()->registerFactory(
                new CppTools::CppCodeStylePreferencesFactory());

    // Menus
    Core::ActionContainer *mtools = am->actionContainer(Core::Constants::M_TOOLS);
    Core::ActionContainer *mcpptools = am->createMenu(CppTools::Constants::M_TOOLS_CPP);
    QMenu *menu = mcpptools->menu();
    menu->setTitle(tr("&C++"));
    menu->setEnabled(true);
    mtools->addMenu(mcpptools);

    // Actions
    Core::Context context(CppEditor::Constants::C_CPPEDITOR);

    QAction *switchAction = new QAction(tr("Switch Header/Source"), this);
    Core::Command *command = am->registerAction(switchAction, Constants::SWITCH_HEADER_SOURCE, context, true);
    command->setDefaultKeySequence(QKeySequence(Qt::Key_F4));
    mcpptools->addAction(command);
    connect(switchAction, SIGNAL(triggered()), this, SLOT(switchHeaderSource()));

    return true;
}
Example #7
0
    QMenu *VariableLineEdit::createResourcesMenu(QMenu *parentMenu, bool ignoreMultiline)
    {
        Q_UNUSED(ignoreMultiline)

        //Do not allow inserting resources here, it doen't make any sense since we cannot overwrite resources

        QMenu *resourceMenu = new QMenu(tr("Cannot insert resources here"), parentMenu);
        resourceMenu->setEnabled(false);
        resourceMenu->setIcon(QIcon(":/images/resource.png"));

        return resourceMenu;
    }
void MainWindow::ExternalPopup::populate( DB::ImageInfoPtr current, const DB::FileNameList& imageList )
{
    _list = imageList;
    _currentInfo = current;
    clear();
    QAction *action;

    QStringList list = QStringList() << i18n("Current Item") << i18n("All Selected Items") << i18n("Copy and Open");
    for ( int which = 0; which < 3; ++which ) {
        if ( which == 0 && !current )
            continue;

        const bool multiple = (_list.count() > 1);
        const bool enabled = (which != 1 && _currentInfo ) || (which == 1 && multiple);

        // Submenu
        QMenu *submenu = addMenu( list[which] );
        submenu->setEnabled(enabled);

        // Fetch set of offers
        OfferType offers;
        if ( which == 0 )
            offers = appInfos( DB::FileNameList() << current->fileName() );
        else
            offers = appInfos( imageList );

        for ( OfferType::const_iterator offerIt = offers.begin(); offerIt != offers.end(); ++offerIt ) {
            action = submenu->addAction( (*offerIt).first );
            action->setObjectName( (*offerIt).first ); // Notice this is needed to find the application later!
            action->setIcon( KIcon((*offerIt).second) );
            action->setData( which );
            action->setEnabled( enabled );
        }

        // A personal command
        action = submenu->addAction( i18n("Open With...") );
        action->setObjectName( i18n("Open With...") ); // Notice this is needed to find the application later!
        // XXX: action->setIcon( KIcon((*offerIt).second) );
        action->setData( which );
        action->setEnabled( enabled );

        // A personal command
        // XXX: see kdialog.h for simple usage
        action = submenu->addAction( i18n("Your Command Line") );
        action->setObjectName( i18n("Your Command Line") ); // Notice this is needed to find the application later!
        // XXX: action->setIcon( KIcon((*offerIt).second) );
        action->setData( which );
        action->setEnabled( enabled );
    }
}
Example #9
0
void MainWindow::showInstanceContextMenu(const QPoint &pos)
{
	QList<QAction *> actions;

	QAction *actionSep = new QAction("", this);
	actionSep->setSeparator(true);

	bool onInstance = view->indexAt(pos).isValid();
	if (onInstance)
	{
		actions = ui->instanceToolBar->actions();

		QAction *actionVoid = new QAction(m_selectedInstance->name(), this);
		actionVoid->setEnabled(false);

		QAction *actionRename = new QAction(tr("Rename"), this);
		actionRename->setToolTip(ui->actionRenameInstance->toolTip());

		QAction *actionCopyInstance = new QAction(tr("Copy instance"), this);
		actionCopyInstance->setToolTip(ui->actionCopyInstance->toolTip());


		connect(actionRename, SIGNAL(triggered(bool)), SLOT(on_actionRenameInstance_triggered()));
		connect(actionCopyInstance, SIGNAL(triggered(bool)), SLOT(on_actionCopyInstance_triggered()));

		actions.replace(1, actionRename);
		actions.prepend(actionSep);
		actions.prepend(actionVoid);
		actions.append(actionCopyInstance);
	}
	else
	{
		QAction *actionVoid = new QAction(tr("MultiMC"), this);
		actionVoid->setEnabled(false);

		QAction *actionCreateInstance = new QAction(tr("Create instance"), this);
		actionCreateInstance->setToolTip(ui->actionAddInstance->toolTip());

		connect(actionCreateInstance, SIGNAL(triggered(bool)), SLOT(on_actionAddInstance_triggered()));

		actions.prepend(actionSep);
		actions.prepend(actionVoid);
		actions.append(actionCreateInstance);
	}
	QMenu myMenu;
	myMenu.addActions(actions);
	if(onInstance)
		myMenu.setEnabled(m_selectedInstance->canLaunch());
	myMenu.exec(view->mapToGlobal(pos));
}
Example #10
0
bool QmlJSToolsPlugin::initialize(const QStringList &arguments, QString *error)
{
    Q_UNUSED(arguments)
    Q_UNUSED(error)

    Utils::MimeDatabase::addMimeTypes(QLatin1String(":/qmljstools/QmlJSTools.mimetypes.xml"));

    m_settings = new QmlJSToolsSettings(this); // force registration of qmljstools settings

    // Objects
    m_modelManager = new ModelManager(this);

//    VCSManager *vcsManager = core->vcsManager();
//    DocumentManager *fileManager = core->fileManager();
//    connect(vcsManager, SIGNAL(repositoryChanged(QString)),
//            m_modelManager, SLOT(updateModifiedSourceFiles()));
//    connect(fileManager, SIGNAL(filesChangedInternally(QStringList)),
//            m_modelManager, SLOT(updateSourceFiles(QStringList)));

    LocatorData *locatorData = new LocatorData;
    addAutoReleasedObject(locatorData);
    addAutoReleasedObject(new FunctionFilter(locatorData));
    addAutoReleasedObject(new QmlJSCodeStyleSettingsPage);
    addAutoReleasedObject(new BasicBundleProvider);

    // Menus
    ActionContainer *mtools = ActionManager::actionContainer(Core::Constants::M_TOOLS);
    ActionContainer *mqmljstools = ActionManager::createMenu(Constants::M_TOOLS_QMLJS);
    QMenu *menu = mqmljstools->menu();
    menu->setTitle(tr("&QML/JS"));
    menu->setEnabled(true);
    mtools->addMenu(mqmljstools);

    // Update context in global context
    m_resetCodeModelAction = new QAction(tr("Reset Code Model"), this);
    Command *cmd = ActionManager::registerAction(
                m_resetCodeModelAction, Constants::RESET_CODEMODEL);
    connect(m_resetCodeModelAction, &QAction::triggered,
            m_modelManager, &ModelManager::resetCodeModel);
    mqmljstools->addAction(cmd);

    // watch task progress
    connect(ProgressManager::instance(), SIGNAL(taskStarted(Core::Id)),
            this, SLOT(onTaskStarted(Core::Id)));
    connect(ProgressManager::instance(), SIGNAL(allTasksFinished(Core::Id)),
            this, SLOT(onAllTasksFinished(Core::Id)));

    return true;
}
Example #11
0
void imageW::contextMenuEvent(QContextMenuEvent *ev) {
    QMenu contMenu(this);
    contMenu.addAction(paintMode);
    contMenu.addSeparator();
//    QMenu zoomM(this);
    QMenu *zoomM = contMenu.addMenu("Zoom");
    zoomM->addAction(xOneZoom);
    zoomM->addAction(xTwoZoom);
    zoomM->addAction(xThreeZoom);
    zoomM->addAction(xFourZoom);
    zoomM->addAction(xFiveZoom);
    if (!loopMode) {
        zoomM->setEnabled(false);
    }
    contMenu.exec(ev->globalPos());
}
Example #12
0
bool MacrosPlugin::initialize(const QStringList &arguments, QString *errorMessage)
{
    Q_UNUSED(arguments);
    Q_UNUSED(errorMessage);

    addAutoReleasedObject(new MacroOptionsPage);
    addAutoReleasedObject(new MacroLocatorFilter);

    Core::Context globalcontext(Core::Constants::C_GLOBAL);
    Core::Context textContext(TextEditor::Constants::C_TEXTEDITOR);
    m_macroManager = new MacroManager(this);

    // Menus
    Core::ActionContainer *mtools = Core::ActionManager::actionContainer(Core::Constants::M_TOOLS);
    Core::ActionContainer *mmacrotools = Core::ActionManager::createMenu(Constants::M_TOOLS_MACRO);
    QMenu *menu = mmacrotools->menu();
    menu->setTitle(tr("&Macros"));
    menu->setEnabled(true);
    mtools->addMenu(mmacrotools);

    QAction *startMacro = new QAction(tr("Record Macro"),  this);
    Core::Command *command = Core::ActionManager::registerAction(startMacro, Constants::START_MACRO, textContext);
    command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Ctrl+(") : tr("Alt+(")));
    mmacrotools->addAction(command);
    connect(startMacro, SIGNAL(triggered()), m_macroManager, SLOT(startMacro()));

    QAction *endMacro = new QAction(tr("Stop Recording Macro"),  this);
    endMacro->setEnabled(false);
    command = Core::ActionManager::registerAction(endMacro, Constants::END_MACRO, globalcontext);
    command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Ctrl+)") : tr("Alt+)")));
    mmacrotools->addAction(command);
    connect(endMacro, SIGNAL(triggered()), m_macroManager, SLOT(endMacro()));

    QAction *executeLastMacro = new QAction(tr("Play Last Macro"),  this);
    command = Core::ActionManager::registerAction(executeLastMacro, Constants::EXECUTE_LAST_MACRO, textContext);
    command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+R") : tr("Alt+R")));
    mmacrotools->addAction(command);
    connect(executeLastMacro, SIGNAL(triggered()), m_macroManager, SLOT(executeLastMacro()));

    QAction *saveLastMacro = new QAction(tr("Save Last Macro"),  this);
    saveLastMacro->setEnabled(false);
    command = Core::ActionManager::registerAction(saveLastMacro, Constants::SAVE_LAST_MACRO, textContext);
    mmacrotools->addAction(command);
    connect(saveLastMacro, SIGNAL(triggered()), m_macroManager, SLOT(saveLastMacro()));

    return true;
}
Example #13
0
/*! Initializes the plugin. Returns true on success.
    Plugins want to register objects with the plugin manager here.

    \a errorMessage can be used to pass an error message to the plugin system,
       if there was any.
*/
bool HelloWorldPlugin::initialize(const QStringList &arguments, QString *errorMessage)
{
    Q_UNUSED(arguments)
    Q_UNUSED(errorMessage)

    // Get the primary access point to the workbench.
    Core::ICore *core = Core::ICore::instance();

    // Create a unique context for our own view, that will be used for the
    // menu entry later.
    Core::Context context("HelloWorld.MainView");

    // Create an action to be triggered by a menu entry
    QAction *helloWorldAction = new QAction(tr("Say \"&Hello World!\""), this);
    connect(helloWorldAction, SIGNAL(triggered()), SLOT(sayHelloWorld()));

    // Register the action with the action manager
    Core::ActionManager *actionManager = core->actionManager();
    Core::Command *command =
            actionManager->registerAction(
                    helloWorldAction, "HelloWorld.HelloWorldAction", context);

    // Create our own menu to place in the Tools menu
    Core::ActionContainer *helloWorldMenu =
            actionManager->createMenu("HelloWorld.HelloWorldMenu");
    QMenu *menu = helloWorldMenu->menu();
    menu->setTitle(tr("&Hello World"));
    menu->setEnabled(true);

    // Add the Hello World action command to the menu
    helloWorldMenu->addAction(command);

    // Request the Tools menu and add the Hello World menu to it
    Core::ActionContainer *toolsMenu =
            actionManager->actionContainer(Core::Constants::M_TOOLS);
    toolsMenu->addMenu(helloWorldMenu);

    // Add a mode with a push button based on BaseMode. Like the BaseView,
    // it will unregister itself from the plugin manager when it is deleted.
    Core::IMode *helloMode = new HelloMode;
    addAutoReleasedObject(helloMode);

    return true;
}
Example #14
0
void ArrowPointCanvas::menu(const QPoint &)
{
    QMenu m;

    MenuFactory::createTitle(m, QObject::tr("Line break"));
    m.addSeparator();
    MenuFactory::addItem(m,QObject::tr("Remove from diagram"), 0);
    m.setEnabled(lines.at(0)->may_join());
    // m.actions().at(0)->setItemEnabled(0, lines.at(0)->may_join());
    QAction *retAction = m.exec(QCursor::pos());
    if(retAction)
        switch (retAction->data().toInt()) {
        case 0:
            // removes the point replacing the lines around it by a single line
            lines.at(0)->join(lines.at(1), this);
            break;

        default:
            return;
        }

    package_modified();
}
bool ColorPickerPlugin::initialize(const QStringList &arguments,
                                   QString *errorMessage)
{
    Q_UNUSED(arguments);
    Q_UNUSED(errorMessage);

    auto optionsPage = new ColorPickerOptionsPage;
    d->generalSettings = optionsPage->generalSettings();

    connect(optionsPage, &ColorPickerOptionsPage::generalSettingsChanged,
            this, &ColorPickerPlugin::onGeneralSettingsChanged);

    // Register the plugin actions
    ActionContainer *toolsContainer = ActionManager::actionContainer(Core::Constants::M_TOOLS);

    ActionContainer *myContainer = ActionManager::createMenu("ColorPicker");
    QMenu *myMenu = myContainer->menu();
    myMenu->setTitle(tr("&ColorPicker"));
    myMenu->setEnabled(true);

    auto triggerColorEditAction = new QAction(tr(Constants::ACTION_NAME_TRIGGER_COLOR_EDIT), this);
    Command *command = ActionManager::registerAction(triggerColorEditAction,
                                                     Constants::TRIGGER_COLOR_EDIT);
    command->setDefaultKeySequence(QKeySequence(tr("Ctrl+Alt+C")));

    myContainer->addAction(command);

    connect(triggerColorEditAction, &QAction::triggered,
            this, &ColorPickerPlugin::onColorEditTriggered);

    toolsContainer->addMenu(myContainer);

    // Register objects
    addAutoReleasedObject(optionsPage);

    return true;
}
Example #16
0
    void CodeEditorDialog::on_insertPushButton_clicked()
    {
        QSet<QString> variables = ActionTools::ActionInstance::findVariables(text(), isCode());

        for(QAction *action: mVariablesMenu->actions())
            variables.insert(action->text());

        QStringList variableList = variables.toList();
        std::sort(variableList.begin(), variableList.end());

        QMenu *variablesMenu = 0;

        if(variableList.isEmpty())
        {
            variablesMenu = new QMenu(tr("No variables to insert"));
            variablesMenu->setEnabled(false);
        }
        else
        {
            variablesMenu = new QMenu(tr("Insert variable"));
            connect(variablesMenu, SIGNAL(triggered(QAction*)), this, SLOT(insertVariable(QAction*)));
            for(const QString &variable: variableList)
                variablesMenu->addAction(variable);
        }

        variablesMenu->setIcon(QIcon(":/images/variable.png"));

        QMenu *menu = new QMenu;

        menu->addMenu(variablesMenu);
        menu->addMenu(mResourcesMenu);

        menu->exec(QCursor::pos());

        delete menu;
    }
void DesignerEventHandler::onContextMenu(QContextMenuEvent * e)
{
  QMenu * menu = new QMenu(parentWidget);

  QAction * copy_action     = menu->addAction(tr("Copy"), this, SLOT(onCopy()));
  menu->addAction(tr("Paste"), this, SLOT(onPaste()));
  QAction * delete_action   = menu->addAction(tr("Delete"), this, SLOT(onDelete()));
  QAction * delete_with_s_action   = menu->addAction(tr("Delete with sourcers"), this, SLOT(onDeleteWithSourcers()));
  QMenu* go = menu->addMenu(tr("Geometry operations"));
  go->addAction(tr("Align left") , this, SLOT(onAlignLeft()));
  go->addAction(tr("Align top")  , this, SLOT(onAlignTop()));
  go->addAction(tr("Align right"), this, SLOT(onAlignRight()));
  go->addAction(tr("Align bottom"),this, SLOT(onAlignBottom()));
  go->addAction(tr("Align vertical"),this, SLOT(onAlignVertical()));
  go->addAction(tr("Align horisontal"), this, SLOT (onAlignHorizontal()) );
  go->addAction(tr("Queue x"), this, SLOT (onQuequeX()) );
  go->addAction(tr("Queue y"), this, SLOT (onQuequeY()) );
  go->insertSeparator();
  go->addAction(tr("Same width"), this, SLOT(onSameWidth()));
  go->addAction(tr("Same height"), this, SLOT(onSameHeight()));
  QMenu* popupWindows = menu->addMenu(tr("Popup windows"));
  QMenu* leftButtonPW = popupWindows->addMenu(tr("Left button"));
  QAction * left_pw_add_action    = leftButtonPW->addAction( tr("Add"), this, SLOT(onLeftPwAdd()));
  QAction * left_pw_copy_action   = leftButtonPW->addAction( tr("Copy"), this, SLOT(onLeftPwCopy()));
  leftButtonPW->addAction( tr("Paste"), this, SLOT(onLeftPwPaste()));
  QAction * left_pw_delete_action = leftButtonPW->addAction( tr("Delete"), this, SLOT(onLeftDelete()));
  QMenu* rightButtonPW = popupWindows->addMenu (tr ("Right button"));
  QAction * right_pw_add_action    = rightButtonPW->addAction( tr("Add"), this, SLOT(onRightPwAdd()));
  QAction * right_pw_copy_action   = rightButtonPW->addAction( tr("Copy"), this, SLOT(onRightPwCopy()));
  rightButtonPW->addAction( tr("Paste"), this, SLOT(onRightPwPaste()));
  QAction * right_pw_delete_action = rightButtonPW->addAction( tr("Delete"), this, SLOT(onRightDelete()));

  QAction* show_properties_action = menu->addAction(tr("Properties"), this, SLOT(showProps()));
  QFont f = show_properties_action->font();
  f.setBold(true);
  show_properties_action->setFont(f);

  menu->addAction( tr("Export lists"), this, SLOT(onExportLists()) );
  //menu->insertSeparator();
  QMenu * predef = menu->addMenu ("Predef windows");
  QStringList names = PredefPw::Factory::availableNames();
  for (QStringList::iterator iter = names.begin(); iter != names.end(); ++iter ) {
    QAction * a = predef->addAction (*iter);
    //a->setMenu (predef);
    a->setData (12345);
  }
  
  menu->addAction ( "Find sourcer", this, SLOT (onFindSourcerByWidget() ) );
   
  if (selected_widgets.count( ) == 0 ){
    copy_action->setEnabled(false);
    delete_action->setEnabled(false);
    delete_with_s_action->setEnabled(false);
    go->setEnabled(false);
    popupWindows->setEnabled(false);
  }
  else {
    VtlWidget * w = (VtlWidget*)checkWidget(e->pos());
    if (w) {
      if (w->isLbPopupCreated()) {
        left_pw_add_action->setEnabled(false);
      }
      else {
        left_pw_copy_action->setEnabled(false);
        left_pw_delete_action->setEnabled(false);
      }
      if (w->isRbPopupCreated()) {
        right_pw_add_action->setEnabled(false);
      }
      else {
        right_pw_copy_action->setEnabled(false);
        right_pw_delete_action->setEnabled(false);
      }
    }
  }
  
  if ( context_widget )
    context_widget->prepareContextMenu (menu);
  
  if (e->state() & Qt::ControlModifier )
    control_modifier = true;
    
  QAction * a = menu->exec(e->globalPos());
  
  control_modifier = false;
  
  if ( a && a->data().toInt() == 12345 ) {
    QMessageBox box ( vtl::app );
    QAbstractButton * left_btn  = box.addButton ("Left" , QMessageBox::ActionRole );
    QAbstractButton * right_btn = box.addButton ("Right", QMessageBox::ActionRole );
    box.setWindowTitle ("Mouse button?");
    
    box.exec ();
    if ( box.clickedButton()     == left_btn ) {
      for (SWPtrList::iterator iter = selected_widgets.begin(); iter != selected_widgets.end(); ++iter )  {
         (*iter)->createLbPredefPw ( a->text() );
      }
    }
    else if (box.clickedButton() == right_btn ) {
      for (SWPtrList::iterator iter = selected_widgets.begin(); iter != selected_widgets.end(); ++iter )  {
         (*iter)->createRbPredefPw ( a->text() );
      }
    }
  }

  delete menu;
}
Example #18
0
void FriendWidget::contextMenuEvent(QContextMenuEvent * event)
{
    QPoint pos = event->globalPos();
    QString id = Core::getInstance()->getFriendAddress(friendId);
    QString dir = Settings::getInstance().getAutoAcceptDir(id);
    QMenu menu;
    QMenu* inviteMenu = menu.addMenu(tr("Invite to group","Menu to invite a friend to a groupchat"));
    QAction* copyId = menu.addAction(tr("Copy friend ID","Menu to copy the Tox ID of that friend"));
    QMap<QAction*, Group*> groupActions;
    
    for (Group* group : GroupList::groupList)
    {
        QAction* groupAction = inviteMenu->addAction(group->widget->getName());
        groupActions[groupAction] =  group;
    }
    
    if (groupActions.isEmpty())
        inviteMenu->setEnabled(false);
    
    QAction* setAlias = menu.addAction(tr("Set alias..."));

    menu.addSeparator();
    QAction* autoAccept = menu.addAction(tr("Auto accept files from this friend", "context menu entry"));
    autoAccept->setCheckable(true);
    autoAccept->setChecked(!dir.isEmpty());
    menu.addSeparator();
    
    QAction* removeFriendAction = menu.addAction(tr("Remove friend", "Menu to remove the friend from our friendlist"));

    QAction* selectedItem = menu.exec(pos);
    if (selectedItem)
    {
        if (selectedItem == copyId)
        {
            emit copyFriendIdToClipboard(friendId);
            return;
        } else if (selectedItem == setAlias)
        {
            setFriendAlias();
        }
        else if (selectedItem == removeFriendAction)
        {
            hide();
            show(); //Toggle visibility to work around bug of repaintEvent() not being fired on parent widget when this is hidden
            hide();
            emit removeFriend(friendId);
            return;
        }
        else if (selectedItem == autoAccept)
        {
            if (!autoAccept->isChecked())
            {
                qDebug() << "not checked";
                dir = QDir::homePath();
                autoAccept->setChecked(false);
                Settings::getInstance().setAutoAcceptDir(id, "");
            }
            
            if (autoAccept->isChecked())
            {
                dir = QFileDialog::getExistingDirectory(0, tr("Choose an auto accept directory","popup title"), dir);
                autoAccept->setChecked(true);
                qDebug() << "FriendWidget: setting auto accept dir for" << friendId << "to" << dir;
                Settings::getInstance().setAutoAcceptDir(id, dir);
            }
        }
        else if (groupActions.contains(selectedItem))
        {
            Group* group = groupActions[selectedItem];
            Core::getInstance()->groupInviteFriend(friendId, group->groupId);
        }
    }
}
void JoyButtonContextMenu::buildMenu()
{
    QAction *action = 0;

    action = this->addAction(tr("Toggle"));
    action->setCheckable(true);
    action->setChecked(button->getToggleState());
    connect(action, SIGNAL(triggered()), this, SLOT(switchToggle()));

    action = this->addAction(tr("Turbo"));
    action->setCheckable(true);
    action->setChecked(button->isUsingTurbo());
    connect(action, SIGNAL(triggered()), this, SLOT(switchToggle()));

    this->addSeparator();

    action = this->addAction(tr("Clear"));
    action->setCheckable(false);
    connect(action, SIGNAL(triggered()), this, SLOT(clearButton()));

    this->addSeparator();

    QMenu *setSectionMenu = this->addMenu(tr("Set Select"));

    action = setSectionMenu->addAction(tr("Disabled"));
    if (button->getChangeSetCondition() == JoyButton::SetChangeDisabled)
    {
        action->setCheckable(true);
        action->setChecked(true);
    }
    connect(action, SIGNAL(triggered()), this, SLOT(disableSetMode()));

    setSectionMenu->addSeparator();

    for (int i=0; i < InputDevice::NUMBER_JOYSETS; i++)
    {
        QMenu *tempSetMenu = setSectionMenu->addMenu(tr("Set %1").arg(i+1));
        int setSelection = i*3;

        if (i == button->getSetSelection())
        {
            QFont tempFont = tempSetMenu->menuAction()->font();
            tempFont.setBold(true);
            tempSetMenu->menuAction()->setFont(tempFont);
        }

        QActionGroup *tempGroup = new QActionGroup(tempSetMenu);

        action = tempSetMenu->addAction(tr("Set %1 1W").arg(i+1));
        action->setData(QVariant(setSelection + 0));
        action->setCheckable(true);
        if (button->getSetSelection() == i &&
            button->getChangeSetCondition() == JoyButton::SetChangeOneWay)
        {
            action->setChecked(true);
        }
        connect(action, SIGNAL(triggered()), this, SLOT(switchSetMode()));
        tempGroup->addAction(action);

        action = tempSetMenu->addAction(tr("Set %1 2W").arg(i+1));
        action->setData(QVariant(setSelection + 1));
        action->setCheckable(true);
        if (button->getSetSelection() == i &&
            button->getChangeSetCondition() == JoyButton::SetChangeTwoWay)
        {
            action->setChecked(true);
        }
        connect(action, SIGNAL(triggered()), this, SLOT(switchSetMode()));
        tempGroup->addAction(action);

        action = tempSetMenu->addAction(tr("Set %1 WH").arg(i+1));
        action->setData(QVariant(setSelection + 2));
        action->setCheckable(true);
        if (button->getSetSelection() == i &&
            button->getChangeSetCondition() == JoyButton::SetChangeWhileHeld)
        {
            action->setChecked(true);
        }
        connect(action, SIGNAL(triggered()), this, SLOT(switchSetMode()));
        tempGroup->addAction(action);

        if (i == button->getParentSet()->getIndex())
        {
            tempSetMenu->setEnabled(false);
        }
    }
}
Example #20
0
 void setEnabled(bool enabled)
 {
   menu ? menu->setEnabled(enabled) : menuBar->setEnabled(enabled);
 }
void SceneViewerContextMenu::addLevelCommands(std::vector<int> &indices) {
  addSeparator();
  TXsheet *xsh = TApp::instance()->getCurrentXsheet()->getXsheet();
  TStageObjectId currentId =
      TApp::instance()->getCurrentObject()->getObjectId();

  /*- Xsheet内の、空でないColumnを登録 -*/
  std::vector<TXshColumn *> columns;
  for (int i = 0; i < (int)indices.size(); i++) {
    if (xsh->isColumnEmpty(indices[i])) continue;
    TXshColumn *column = xsh->getColumn(indices[i]);
    if (column) {
      columns.push_back(column);
    }
  }

  if (!columns.empty()) {
    // show/hide
    if (columns.size() > 1) {
      QMenu *subMenu = addMenu("Show / Hide");
      for (int i = 0; i < (int)columns.size(); i++)
        addShowHideCommand(subMenu, columns[i]);
    } else
      addShowHideCommand(this, columns[0]);
    addSeparator();
  }

  // selection
  /*
    if(selectableColumns.size()==1)
    {
      addSelectCommand(this,
    TStageObjectId::ColumnId(selectableColumns[0]->getIndex()));
    }
    else
    */

  /*-- Scene内の全Objectを選択可能にする --*/
  TStageObjectId id;
  QMenu *cameraMenu = addMenu(tr("Select Camera"));
  QMenu *pegbarMenu = addMenu(tr("Select Pegbar"));
  QMenu *columnMenu = addMenu(tr("Select Column"));

  bool flag = false;

  for (int i = 0; i < xsh->getStageObjectTree()->getStageObjectCount(); i++) {
    id = xsh->getStageObjectTree()->getStageObject(i)->getId();
    if (id.isColumn()) {
      int columnIndex = id.getIndex();
      if (xsh->isColumnEmpty(columnIndex))
        continue;
      else {
        addSelectCommand(columnMenu, id);
        flag = true;
      }
    } else if (id.isTable())
      addSelectCommand(this, id);
    else if (id.isCamera())
      addSelectCommand(cameraMenu, id);
    else if (id.isPegbar())
      addSelectCommand(pegbarMenu, id);
  }

  /*- カラムがひとつも無かったらDisable -*/
  if (!flag) columnMenu->setEnabled(false);
}
void MainWindow::contextMenu(const QPoint &p)
{
    // mostra o menu de contexto para o item na posicao "p"
    QGraphicsItem *item = ui->graphicsView->itemAt(p);

    if (item) {
        // o menu deve ser mostrado na posicao onde o mouse foi clicado
        QPoint globalPos = ui->graphicsView->mapToGlobal(p);
        QMenu menu;

        QMenu *linha = new QMenu("Linha/Texto", &menu);
        QMenu *preenchimento = new QMenu("Preenchimento", &menu);
        QMenu *menuLinha = new QMenu("Estilo", linha);
        QMenu *menuPadroes = new QMenu("Padrões", preenchimento);
        QMenu *menuEspessura = new QMenu("Espessura", linha);

        QAction* estilo1 = new QAction(" - - - - - ", menuLinha);
        QAction* estilo2 = new QAction(" - . - . - ", menuLinha);
        QAction* estilo3 = new QAction(" - .. - .. - ", menuLinha);

        menuLinha->addAction(estilo1);
        menuLinha->addAction(estilo2);
        menuLinha->addAction(estilo3);

        QAction* estiloPadrao1 = new QAction("Linhas horizontais", menuPadroes);
        QAction* estiloPadrao2 = new QAction("Linhas verticais", menuPadroes);
        QAction* estiloPadrao3 = new QAction("Quadriculado", menuPadroes);

        menuPadroes->addAction(estiloPadrao1);
        menuPadroes->addAction(estiloPadrao2);
        menuPadroes->addAction(estiloPadrao3);

        QAction* espessura1 = new QAction("2", menuEspessura);
        QAction* espessura2 = new QAction("3", menuEspessura);
        QAction* espessura3 = new QAction("4", menuEspessura);

        menuEspessura->addAction(espessura1);
        menuEspessura->addAction(espessura2);
        menuEspessura->addAction(espessura3);

        QAction* corLinha = new QAction("Cor", linha);
        QAction* corPreen = new QAction("Cor", preenchimento);

        linha->addAction(corLinha);
        linha->addAction(menuLinha->menuAction());
        linha->addAction(menuEspessura->menuAction());

        preenchimento->addAction(menuPadroes->menuAction());
        preenchimento->addAction(corPreen);

        menu.addAction(linha->menuAction());
        menu.addAction(preenchimento->menuAction());

        QAction* selectedItem;
        int tipoItem = item->type();

        // seleciona o que vai ficar Habilitado/Desabilitado no menu baseado no item selecionado
        if (tipoItem == MainWindow::Line) {
            if (QGraphicsItemGroup *g = item->group()) {
                preenchimento->setEnabled(false);
                menuLinha->setEnabled(false);

                // pega a entrada do menu que foi selecionada
                selectedItem = menu.exec(globalPos);
                if (selectedItem) {

                    // Alterar Cor da Linha
                    if (selectedItem == corLinha) {
                        QColor cor = QColorDialog::getColor();
                        if (cor.isValid())
                           foreach (QGraphicsItem* i, g->childItems())
                               (static_cast<QGraphicsLineItem*>(i))->setPen(QPen(cor));

                    // Alterar Espessura da Linha: 2
                    } else if (selectedItem == espessura1)  {
                        QList<QGraphicsItem*> itens = g->childItems();
                        QPen currentPen = (static_cast<QGraphicsLineItem*>(itens[0]))->pen();
                        foreach (QGraphicsItem* i, itens)
                            (static_cast<QGraphicsLineItem*>(i))->setPen(QPen(currentPen.brush(), 2));

                    // Alterar Espessura da Linha: 3
                    } else if (selectedItem == espessura2) {
                        QList<QGraphicsItem*> itens = g->childItems();
                        QPen currentPen = (static_cast<QGraphicsLineItem*>(itens[0]))->pen();
                        foreach (QGraphicsItem* i, itens)
                            (static_cast<QGraphicsLineItem*>(i))->setPen(QPen(currentPen.brush(), 3));

                    // Alterar Espessura da Linha: 4
                    } else if (selectedItem == espessura3) {
                        QList<QGraphicsItem*> itens = g->childItems();
                        QPen currentPen = (static_cast<QGraphicsLineItem*>(itens[0]))->pen();
                        foreach (QGraphicsItem* i, itens)
                            (static_cast<QGraphicsLineItem*>(i))->setPen(QPen(currentPen.brush(), 4));
                    }

                }

           } else {
               preenchimento->setEnabled(false);
               // devo recuperar aqui dentro, pois preciso desabilitar algumas opções
               selectedItem = menu.exec(globalPos);

               if (selectedItem) {
                   if (selectedItem == estilo1) {
                       QPen currentPen = (static_cast<QGraphicsLineItem*>(item))->pen();

                       currentPen.setStyle(Qt::DashLine);
                       (static_cast<QGraphicsLineItem*>(item))->setPen(currentPen);

                   } else if (selectedItem == estilo2) {
                       QPen currentPen = (static_cast<QGraphicsLineItem*>(item))->pen();

                       currentPen.setStyle(Qt::DashDotLine);
                       (static_cast<QGraphicsLineItem*>(item))->setPen(currentPen);

                   } else if (selectedItem == estilo3) {
                       QPen currentPen = (static_cast<QGraphicsLineItem*>(item))->pen();

                       currentPen.setStyle(Qt::DashDotDotLine);
                       (static_cast<QGraphicsLineItem*>(item))->setPen(currentPen);


                   } else if (selectedItem == corLinha) {
                       QColor cor = QColorDialog::getColor();

                       if (cor.isValid()) {
                           QPen currentPen = (static_cast<QGraphicsLineItem*>(item))->pen();
                           currentPen.setColor(cor);
                           (static_cast<QGraphicsLineItem*>(item))->setPen(currentPen);
                       }

                   } else if (selectedItem == espessura1) {

                       QPen currentPen = (static_cast<QGraphicsLineItem*>(item))->pen();

                       (static_cast<QGraphicsLineItem*>(item))->setPen(QPen(currentPen.brush(), 2));

                   } else if (selectedItem == espessura2) {

                       QPen currentPen = (static_cast<QGraphicsLineItem*>(item))->pen();

                       (static_cast<QGraphicsLineItem*>(item))->setPen(QPen(currentPen.brush(), 3));

                   } else if (selectedItem == espessura3) {

                       QPen currentPen = (static_cast<QGraphicsLineItem*>(item))->pen();

                       (static_cast<QGraphicsLineItem*>(item))->setPen(QPen(currentPen.brush(), 4));

                   }
               }


           }
       }
       else {
           if (tipoItem == MainWindow::Quadrado) {

               selectedItem = menu.exec(globalPos);

               if (selectedItem) {
                   if (selectedItem == corLinha) {
                       QColor cor = QColorDialog::getColor();

                       if (cor.isValid()) {
                           QPen currentPen = (static_cast<QGraphicsRectItem*>(item))->pen();
                           currentPen.setColor(cor);
                           (static_cast<QGraphicsRectItem*>(item))->setPen(currentPen);
                       }

                   } else if (selectedItem == estilo1) {
                       QPen currentPen = (static_cast<QGraphicsRectItem*>(item))->pen();

                       currentPen.setStyle(Qt::DashLine);
                       (static_cast<QGraphicsRectItem*>(item))->setPen(currentPen);

                   } else if (selectedItem == estilo2) {
                       QPen currentPen = (static_cast<QGraphicsRectItem*>(item))->pen();

                       currentPen.setStyle(Qt::DashDotLine);
                       (static_cast<QGraphicsRectItem*>(item))->setPen(currentPen);

                   } else if (selectedItem == estilo3) {
                       QPen currentPen = (static_cast<QGraphicsRectItem*>(item))->pen();

                       currentPen.setStyle(Qt::DashDotLine);
                       (static_cast<QGraphicsRectItem*>(item))->setPen(currentPen);

                   } else if (selectedItem == espessura1) {
                       QPen currentPen = (static_cast<QGraphicsRectItem*>(item))->pen();

                       currentPen.setWidth(2);
                       (static_cast<QGraphicsRectItem*>(item))->setPen(currentPen);

                   } else if (selectedItem == espessura2) {
                       QPen currentPen = (static_cast<QGraphicsRectItem*>(item))->pen();

                       currentPen.setWidth(3);
                       (static_cast<QGraphicsRectItem*>(item))->setPen(currentPen);

                   } else if (selectedItem == espessura3) {
                       QPen currentPen = (static_cast<QGraphicsRectItem*>(item))->pen();

                       currentPen.setWidth(4);
                       (static_cast<QGraphicsRectItem*>(item))->setPen(currentPen);

                   } else if (selectedItem == corPreen) {
                       QColor cor = QColorDialog::getColor();

                       if (cor.isValid()) {

                           QPen currentPen = (static_cast<QGraphicsRectItem*>(item))->pen();
                           QBrush b = currentPen.brush();
                           b.setColor(cor);
                           b.setStyle(Qt::SolidPattern);

                           (static_cast<QGraphicsRectItem*>(item))->setBrush(b);
                       }

                   } else if (selectedItem == estiloPadrao1) {
                       QBrush b = (static_cast<QGraphicsRectItem*>(item))->brush();

                       b.setStyle(Qt::HorPattern);
                       (static_cast<QGraphicsRectItem*>(item))->setBrush(b);

                   } else if (selectedItem == estiloPadrao2) {
                       QBrush b = (static_cast<QGraphicsRectItem*>(item))->brush();

                       b.setStyle(Qt::VerPattern);
                       (static_cast<QGraphicsRectItem*>(item))->setBrush(b);

                   } else if (selectedItem == estiloPadrao3) {
                       QBrush b = (static_cast<QGraphicsRectItem*>(item))->brush();

                       b.setStyle(Qt::CrossPattern);
                       (static_cast<QGraphicsRectItem*>(item))->setBrush(b);
                   }
               }

           } else  if (tipoItem == MainWindow::Texto) {
               preenchimento->setEnabled(false);
               menuLinha->setEnabled(false);
               menuEspessura->setEnabled(false);

               selectedItem = menu.exec(globalPos);
               if (selectedItem && selectedItem == corLinha) {
                   QColor cor = QColorDialog::getColor();
                   if (cor.isValid())
                       (static_cast<QGraphicsTextItem*>(item))->setDefaultTextColor(cor);
               }

           } else if (tipoItem == MainWindow::Circulo) {
               selectedItem = menu.exec(globalPos);

               if (selectedItem) {
                   if (selectedItem == corLinha) {
                       QColor cor = QColorDialog::getColor();

                       if (cor.isValid()) {
                           QPen currentPen = (static_cast<QGraphicsEllipseItem*>(item))->pen();
                           currentPen.setColor(cor);
                           (static_cast<QGraphicsEllipseItem*>(item))->setPen(currentPen);
                       }
                   } else if (selectedItem == estilo1) {
                       QPen currentPen = (static_cast<QGraphicsEllipseItem*>(item))->pen();

                       currentPen.setStyle(Qt::DashLine);
                       (static_cast<QGraphicsEllipseItem*>(item))->setPen(currentPen);

                   } else if (selectedItem == estilo2) {
                       QPen currentPen = (static_cast<QGraphicsEllipseItem*>(item))->pen();

                       currentPen.setStyle(Qt::DashDotLine);
                       (static_cast<QGraphicsEllipseItem*>(item))->setPen(currentPen);

                   } else if (selectedItem == estilo3) {
                       QPen currentPen = (static_cast<QGraphicsEllipseItem*>(item))->pen();

                       currentPen.setStyle(Qt::DashDotLine);
                       (static_cast<QGraphicsEllipseItem*>(item))->setPen(currentPen);

                   } else if (selectedItem == espessura1) {
                       QPen currentPen = (static_cast<QGraphicsEllipseItem*>(item))->pen();

                       currentPen.setWidth(2);
                       (static_cast<QGraphicsEllipseItem*>(item))->setPen(currentPen);

                   } else if (selectedItem == espessura2) {
                       QPen currentPen = (static_cast<QGraphicsEllipseItem*>(item))->pen();

                       currentPen.setWidth(3);
                       (static_cast<QGraphicsEllipseItem*>(item))->setPen(currentPen);

                   } else if (selectedItem == espessura3) {
                       QPen currentPen = (static_cast<QGraphicsEllipseItem*>(item))->pen();

                       currentPen.setWidth(4);
                       (static_cast<QGraphicsEllipseItem*>(item))->setPen(currentPen);

                   } else if (selectedItem == corPreen) {
                       QColor cor = QColorDialog::getColor();

                       if (cor.isValid()) {

                           QPen currentPen = (static_cast<QGraphicsEllipseItem*>(item))->pen();
                           QBrush b = currentPen.brush();
                           b.setColor(cor);
                           b.setStyle(Qt::SolidPattern);

                           (static_cast<QGraphicsEllipseItem*>(item))->setBrush(b);
                       }

                   } else if (selectedItem == estiloPadrao1) {
                       QBrush b = (static_cast<QGraphicsEllipseItem*>(item))->brush();

                       b.setStyle(Qt::HorPattern);
                       (static_cast<QGraphicsEllipseItem*>(item))->setBrush(b);

                   } else if (selectedItem == estiloPadrao2) {
                       QBrush b = (static_cast<QGraphicsEllipseItem*>(item))->brush();

                       b.setStyle(Qt::VerPattern);
                       (static_cast<QGraphicsEllipseItem*>(item))->setBrush(b);

                   } else if (selectedItem == estiloPadrao3) {
                       QBrush b = (static_cast<QGraphicsEllipseItem*>(item))->brush();

                       b.setStyle(Qt::CrossPattern);
                       (static_cast<QGraphicsEllipseItem*>(item))->setBrush(b);
                   }
               }
           }
       }
    }
}
void KateProjectTreeViewContextMenu::exec(const QString &filename, const QPoint &pos, QWidget *parent)
{
    /**
     * create context menu
     */
    QMenu menu;

    QAction *copyAction = menu.addAction(QIcon::fromTheme(QStringLiteral("edit-copy")), i18n("Copy Filename"));

    /**
     * handle "open with"
     * find correct mimetype to query for possible applications
     */
    QMenu *openWithMenu = menu.addMenu(i18n("Open With"));
    QMimeType mimeType = QMimeDatabase().mimeTypeForFile(filename);
    KService::List offers = KMimeTypeTrader::self()->query(mimeType.name(), QStringLiteral("Application"));

    /**
     * for each one, insert a menu item...
     */
    for (KService::List::Iterator it = offers.begin(); it != offers.end(); ++it) {
        KService::Ptr service = *it;
        if (service->name() == QStringLiteral("Kate")) {
            continue;    // omit Kate
        }
        QAction *action = openWithMenu->addAction(QIcon::fromTheme(service->icon()), service->name());
        action->setData(service->entryPath());
    }

    /**
     * perhaps disable menu, if no entries!
     */
    openWithMenu->setEnabled(!openWithMenu->isEmpty());

    KMoreToolsMenuFactory menuFactory(QLatin1String("kate/addons/project/git-tools"));

    QMenu gitMenu; // must live as long as the maybe filled menu items should live

    if (isGit(filename)) {

        menuFactory.fillMenuFromGroupingNames(&gitMenu, { QLatin1String("git-clients-and-actions") },
                                                               QUrl::fromLocalFile(filename));

        menu.addSection(i18n("Git:"));
        Q_FOREACH(auto action, gitMenu.actions()) {
            menu.addAction(action);
        }
    }

    /**
     * run menu and handle the triggered action
     */
    if (QAction *action = menu.exec(pos)) {

        // handle apps
        if (copyAction == action) {
            QApplication::clipboard()->setText(filename);
        } else {
            // handle "open with"
            const QString openWith = action->data().toString();
            if (KService::Ptr app = KService::serviceByDesktopPath(openWith)) {
                QList<QUrl> list;
                list << QUrl::fromLocalFile(filename);
                KRun::runService(*app, list, parent);
            }
        }
    }
}
Example #24
0
void ListRenders::contextMenuEvent( QContextMenuEvent *event)
{
	ItemRender* render = (ItemRender*)getCurrentItem();
	if( render == NULL ) return;
	bool me = false;
	if( render->getName().contains( QString::fromUtf8( af::Environment::getComputerName().c_str())) || ( render->getUserName() == QString::fromUtf8( af::Environment::getUserName().c_str()))) me = true;
	int selectedItemsCount = getSelectedItemsCount();

	QMenu menu(this);
	QAction *action;
	QMenu * submenu;

	if( selectedItemsCount <= 1 )
	{
		action = new QAction( render->getName(), this);
		action->setEnabled( false);
		menu.addAction( action);
		menu.addSeparator();
	}

	action = new QAction( "Show Log", this);
	connect( action, SIGNAL( triggered() ), this, SLOT( actRequestLog() ));
	menu.addAction( action);

	action = new QAction( "Tasks Log", this);
	connect( action, SIGNAL( triggered() ), this, SLOT( actRequestTasksLog() ));
	menu.addAction( action);

	action = new QAction( "Show Info", this);
	connect( action, SIGNAL( triggered() ), this, SLOT( actRequestInfo() ));
	menu.addAction( action);
	
	std::list<const af::TaskExec*> l = render->getTasks();
	submenu = new QMenu( l.size() > 1 ? "Running Tasks" : "Running Task", this);
	submenu->setEnabled( render->hasTasks());

	std::list<const af::TaskExec*>::const_iterator it;
	for (it = l.begin() ; it != l.end() ; ++it)
	{
		const af::TaskExec *task = *it;
		QString title = QString("%1[%2][%3]")
			.arg( QString::fromStdString(task->getJobName()))
			.arg( QString::fromStdString(task->getBlockName()))
			.arg( QString::fromStdString(task->getName()));

		action = new ActionIdIdId(
			task->getJobId(),
			task->getBlockNum(),
			task->getTaskNum(),
			title,
			this);

		connect( action, SIGNAL( triggeredId(int,int,int) ),
				 this, SLOT( actRequestTaskInfo(int,int,int) ));

		submenu->addAction( action);
	}
	
	menu.addMenu( submenu);

	if( me || af::Environment::VISOR())
	{
		menu.addSeparator();

		action = new QAction( "Set Priority", this);
		connect( action, SIGNAL( triggered() ), this, SLOT( actPriority() ));
		menu.addAction( action);
		action = new QAction( "Set NIMBY", this);
		if( selectedItemsCount == 1) action->setEnabled(false == render->isNIMBY());
		connect( action, SIGNAL( triggered() ), this, SLOT( actNIMBY() ));
		menu.addAction( action);
		action = new QAction( "Set nimby", this);
		if( selectedItemsCount == 1) action->setEnabled(false == render->isNimby());
		connect( action, SIGNAL( triggered() ), this, SLOT( actNimby() ));
		menu.addAction( action);
		action = new QAction( "Set Free", this);
		if( selectedItemsCount == 1) action->setEnabled(render->isNimby() || render->isNIMBY());
		connect( action, SIGNAL( triggered() ), this, SLOT( actFree() ));
		menu.addAction( action);
		action = new QAction( "Set User", this);
		connect( action, SIGNAL( triggered() ), this, SLOT( actUser() ));
		menu.addAction( action);

		menu.addSeparator();

		action = new QAction( "Annotate", this);
		connect( action, SIGNAL( triggered() ), this, SLOT( actAnnotate() ));
		menu.addAction( action);
		action = new QAction( "Change Capacity", this);
		connect( action, SIGNAL( triggered() ), this, SLOT( actCapacity() ));
		menu.addAction( action);
		action = new QAction( "Change Max Tasks", this);
		connect( action, SIGNAL( triggered() ), this, SLOT( actMaxTasks() ));
		menu.addAction( action);
		action = new QAction( "Enable Service", this);
		connect( action, SIGNAL( triggered() ), this, SLOT( actEnableService() ));
		menu.addAction( action);
		action = new QAction( "Disable Service", this);
		connect( action, SIGNAL( triggered() ), this, SLOT( actDisableService() ));
		menu.addAction( action);
		action = new QAction( "Restore Defaults", this);
		if( selectedItemsCount == 1) action->setEnabled(render->isDirty());
		connect( action, SIGNAL( triggered() ), this, SLOT( actRestoreDefaults() ));
		menu.addAction( action);

		menu.addSeparator();

		submenu = new QMenu( "Eject", this);

		action = new QAction( "All Tasks", this);
		if( selectedItemsCount == 1) action->setEnabled( render->hasTasks());
		connect( action, SIGNAL( triggered() ), this, SLOT( actEjectTasks() ));
		submenu->addAction( action);

		action = new QAction( "Not My Tasks", this);
		if( selectedItemsCount == 1) action->setEnabled( render->hasTasks());
		connect( action, SIGNAL( triggered() ), this, SLOT( actEjectNotMyTasks() ));
		submenu->addAction( action);

		menu.addMenu( submenu);
	}

	QMenu * custom_submenu = NULL;
	int custom_cmd_index = 0;
	if(af::Environment::getRenderCmds().size() > 0)
	{
		menu.addSeparator();
		custom_submenu = new QMenu( "Custom", this);
		for( std::vector<std::string>::const_iterator it = af::Environment::getRenderCmds().begin(); it != af::Environment::getRenderCmds().end(); it++, custom_cmd_index++)
		{
			ActionId * actionid = new ActionId( custom_cmd_index, QString("%1").arg( afqt::stoq(*it)), this);
			connect( actionid, SIGNAL( triggeredId( int ) ), this, SLOT( actCommand( int ) ));
			custom_submenu->addAction( actionid);
		}
		menu.addMenu( custom_submenu);
	}
Example #25
0
void AnnotationDialog::ListSelect::showContextMenu(const QPoint& pos)
{
    QMenu* menu = new QMenu( this );

    QTreeWidgetItem* item = m_treeWidget->itemAt(pos);
    // click on any item
    QString title = i18n("No Item Selected");
    if ( item )
        title = item->text(0);

    QLabel* label = new QLabel( i18n("<b>%1</b>",title), menu );
    label->setAlignment( Qt::AlignCenter );
    QWidgetAction* action = new QWidgetAction(menu);
    action->setDefaultWidget( label );
    menu->addAction(action);

    QAction* deleteAction = menu->addAction( SmallIcon(QString::fromLatin1("edit-delete")), i18n("Delete") );
    QAction* renameAction = menu->addAction( i18n("Rename...") );

    QLabel* categoryTitle = new QLabel( i18n("<b>Tag Groups</b>"), menu );
    categoryTitle->setAlignment( Qt::AlignCenter );
    action = new QWidgetAction( menu );
    action->setDefaultWidget( categoryTitle );
    menu->addAction( action );

    // -------------------------------------------------- Add/Remove member group
    DB::MemberMap& memberMap = DB::ImageDB::instance()->memberMap();
    QMenu* members = new QMenu( i18n( "Tag groups" ) );
    menu->addMenu( members );
    QAction* newCategoryAction = nullptr;
    if ( item ) {
        QStringList grps = memberMap.groups( m_category->name() );

        for( QStringList::ConstIterator it = grps.constBegin(); it != grps.constEnd(); ++it ) {
            if (!memberMap.canAddMemberToGroup(m_category->name(), *it, item->text(0)))
                continue;
            QAction* action = members->addAction( *it );
            action->setCheckable(true);
            action->setChecked( (bool) memberMap.members( m_category->name(), *it, false ).contains( item->text(0) ) );
            action->setData( *it );
        }

        if ( !grps.isEmpty() )
            members->addSeparator();
        newCategoryAction = members->addAction( i18n("Add this tag to a new tag group..." ) );
    }

    QAction* newSubcategoryAction = menu->addAction( i18n( "Make this tag a tag group and add a tag..." ) );

    // -------------------------------------------------- Take item out of category
    QTreeWidgetItem* parent = item ? item->parent() : nullptr;
    QAction* takeAction = nullptr;
    if ( parent )
        takeAction = menu->addAction( i18n( "Remove from tag group %1", parent->text(0) ) );

    // -------------------------------------------------- sort
    QLabel* sortTitle = new QLabel( i18n("<b>Sorting</b>") );
    sortTitle->setAlignment( Qt::AlignCenter );
    action = new QWidgetAction( menu );
    action->setDefaultWidget( sortTitle );
    menu->addAction( action );

    QAction* usageAction = menu->addAction( i18n("Usage") );
    QAction* alphaFlatAction = menu->addAction( i18n("Alphabetical (Flat)") );
    QAction* alphaTreeAction = menu->addAction( i18n("Alphabetical (Tree)") );
    usageAction->setCheckable(true);
    usageAction->setChecked( Settings::SettingsData::instance()->viewSortType() == Settings::SortLastUse);
    alphaFlatAction->setCheckable(true);
    alphaFlatAction->setChecked( Settings::SettingsData::instance()->viewSortType() == Settings::SortAlphaFlat);
    alphaTreeAction->setCheckable(true);
    alphaTreeAction->setChecked( Settings::SettingsData::instance()->viewSortType() == Settings::SortAlphaTree);

    if ( !item ) {
        deleteAction->setEnabled( false );
        renameAction->setEnabled( false );
        members->setEnabled( false );
        newSubcategoryAction->setEnabled( false );
    }
    // -------------------------------------------------- exec
    QAction* which = menu->exec( m_treeWidget->mapToGlobal(pos));
    if ( which == nullptr )
        return;
    else if ( which == deleteAction ) {
        Q_ASSERT( item );
        int code = KMessageBox::warningContinueCancel( this, i18n("<p>Do you really want to delete \"%1\"?<br/>"
                                                                  "Deleting the item will remove any information "
                                                                  "about it from any image containing the item.</p>"
                                                       ,title),
                                                       i18n("Really Delete %1?",item->text(0)),
                                                       KGuiItem(i18n("&Delete"),QString::fromLatin1("editdelete")) );
        if ( code == KMessageBox::Continue ) {
            if (item->checkState(0) == Qt::Checked and m_positionable) {
                // An area could be linked against this. We can use positionableTagDeselected
                // here, as the procedure is the same as if the tag had been deselected.
                emit positionableTagDeselected(m_category->name(), item->text(0));
            }

#ifdef HAVE_KFACE
            // Also delete this tag from the recognition database (if it's there)
            if (m_positionable) {
                m_recognizer = FaceManagement::Recognizer::instance();
                m_recognizer->deleteTag(m_category->name(), item->text(0));
            }
#endif

            m_category->removeItem( item->text(0) );
            rePopulate();
        }
    }
    else if ( which == renameAction ) {
        Q_ASSERT( item );
        bool ok;
        QString newStr = QInputDialog::getText( this,
                                                i18n("Rename Item"), i18n("Enter new name:"),
                                                QLineEdit::Normal,
                                                item->text(0), &ok );

        if ( ok && !newStr.isEmpty() && newStr != item->text(0) ) {
            int code = KMessageBox::questionYesNo( this, i18n("<p>Do you really want to rename \"%1\" to \"%2\"?<br/>"
                                                              "Doing so will rename \"%3\" "
                                                              "on any image containing it.</p>"
                                               ,item->text(0),newStr,item->text(0)),
                                               i18n("Really Rename %1?",item->text(0)) );
            if ( code == KMessageBox::Yes ) {
                QString oldStr = item->text(0);
                m_category->renameItem( oldStr, newStr );
                bool checked = item->checkState(0) == Qt::Checked;
                rePopulate();
                // rePopuldate doesn't ask the backend if the item should be checked, so we need to do that.
                checkItem( newStr, checked );

                // rename the category image too
                QString oldFile = m_category->fileForCategoryImage( category(), oldStr );
                QString newFile = m_category->fileForCategoryImage( category(), newStr );
                KIO::move( QUrl(oldFile), QUrl(newFile) );

                if (m_positionable) {
#ifdef HAVE_KFACE
                    // Handle the identity name that we probably have in the recognition database
                    m_recognizer = FaceManagement::Recognizer::instance();
                    m_recognizer->changeIdentityName(m_category->name(), oldStr, newStr);
#endif
                    // Also take care of areas that could be linked against this
                    emit positionableTagRenamed(m_category->name(), oldStr, newStr);
                }
            }
        }
    }
    else if ( which == usageAction ) {
        Settings::SettingsData::instance()->setViewSortType( Settings::SortLastUse );
    }
    else if ( which == alphaTreeAction ) {
        Settings::SettingsData::instance()->setViewSortType( Settings::SortAlphaTree );
    }
    else if ( which == alphaFlatAction ) {
        Settings::SettingsData::instance()->setViewSortType( Settings::SortAlphaFlat );
    }
    else if ( which == newCategoryAction ) {
        Q_ASSERT( item );
        QString superCategory = QInputDialog::getText( this,
            i18n("New tag group"),
            i18n("Name for the new tag group the tag will be added to:")
        );
        if ( superCategory.isEmpty() )
            return;
        memberMap.addGroup( m_category->name(), superCategory );
        memberMap.addMemberToGroup( m_category->name(), superCategory, item->text(0) );
        //DB::ImageDB::instance()->setMemberMap( memberMap );
        rePopulate();
    }
    else if ( which == newSubcategoryAction ) {
        Q_ASSERT( item );
        QString subCategory = QInputDialog::getText( this,
            i18n("Add a tag"),
            i18n("Name for the tag to be added to this tag group:")
        );
        if ( subCategory.isEmpty() )
            return;

         m_category->addItem( subCategory );
         memberMap.addGroup( m_category->name(), item->text(0) );
         memberMap.addMemberToGroup( m_category->name(), item->text(0), subCategory );
         //DB::ImageDB::instance()->setMemberMap( memberMap );
        if ( isInputMode() )
            m_category->addItem( subCategory );

        rePopulate();
        if ( isInputMode() )
            checkItem( subCategory, true );
    }
    else if ( which == takeAction ) {
        Q_ASSERT( item );
        memberMap.removeMemberFromGroup( m_category->name(), parent->text(0), item->text(0) );
        rePopulate();
    }
    else {
        Q_ASSERT( item );
        QString checkedItem = which->data().value<QString>();
        if ( which->isChecked() ) // choosing the item doesn't check it, so this is the value before.
            memberMap.addMemberToGroup( m_category->name(), checkedItem, item->text(0) );
        else
            memberMap.removeMemberFromGroup( m_category->name(), checkedItem, item->text(0) );
        rePopulate();
    }

    delete menu;
}
void HeaderViewWidget::contextMenuEvent(QContextMenuEvent *event)
{
	ItemViewWidget *view = qobject_cast<ItemViewWidget*>(parent());

	if (!view)
	{
		return;
	}

	const int sortColumn = view->getSortColumn();
	const int sortOrder = view->getSortOrder();

	QMenu menu(this);
	QMenu *sortMenu = menu.addMenu(tr("Sorting"));
	QAction *sortAscendingAction = sortMenu->addAction(tr("Sort Ascending"));
	sortAscendingAction->setData(-2);
	sortAscendingAction->setCheckable(true);
	sortAscendingAction->setChecked(sortOrder == Qt::AscendingOrder);

	QAction *sortDescendingAction = sortMenu->addAction(tr("Sort Descending"));
	sortDescendingAction->setData(-3);
	sortDescendingAction->setCheckable(true);
	sortDescendingAction->setChecked(sortOrder == Qt::DescendingOrder);

	sortMenu->addSeparator();

	QAction *noSortAction = sortMenu->addAction(tr("No Sorting"));
	noSortAction->setData(-1);
	noSortAction->setCheckable(true);
	noSortAction->setChecked(sortColumn < 0);

	sortMenu->addSeparator();

	QMenu *visibilityMenu = menu.addMenu(tr("Visible Columns"));
	visibilityMenu->setEnabled(model()->columnCount() > 1);

	QAction *showAllColumnsAction = NULL;
	bool allColumnsVisible = true;

	if (visibilityMenu->isEnabled())
	{
		showAllColumnsAction = visibilityMenu->addAction(tr("Show All"));
		showAllColumnsAction->setData(-1);
		showAllColumnsAction->setCheckable(true);

		visibilityMenu->addSeparator();
	}

	for (int i = 0; i < model()->columnCount(); ++i)
	{
		const QString title(model()->headerData(i, orientation()).toString());
		QAction *action = sortMenu->addAction(title);
		action->setData(i);
		action->setCheckable(true);
		action->setChecked(i == sortColumn);

		if (visibilityMenu->isEnabled())
		{
			QAction *action = visibilityMenu->addAction(title);
			action->setData(i);
			action->setCheckable(true);
			action->setChecked(!view->isColumnHidden(i));

			if (!action->isChecked())
			{
				allColumnsVisible = false;
			}
		}
	}

	if (showAllColumnsAction)
	{
		showAllColumnsAction->setChecked(allColumnsVisible);
		showAllColumnsAction->setEnabled(!allColumnsVisible);
	}

	connect(sortMenu, SIGNAL(triggered(QAction*)), this, SLOT(toggleSort(QAction*)));
	connect(visibilityMenu, SIGNAL(triggered(QAction*)), this, SLOT(toggleColumnVisibility(QAction*)));

	menu.exec(event->globalPos());
}
Example #27
0
void PropertiesDock::showContextMenu(const QPoint& pos)
{
    const Object *object = mDocument->currentObject();
    if (!object)
        return;

    const QList<QtBrowserItem *> items = mPropertyBrowser->selectedItems();
    const bool customPropertiesSelected = !items.isEmpty() && mPropertyBrowser->allCustomPropertyItems(items);

    bool currentObjectHasAllProperties = true;
    QStringList propertyNames;
    for (QtBrowserItem *item : items) {
        const QString propertyName = item->property()->propertyName();
        propertyNames.append(propertyName);

        if (!object->hasProperty(propertyName))
            currentObjectHasAllProperties = false;
    }

    QMenu contextMenu(mPropertyBrowser);
    QAction *cutAction = contextMenu.addAction(tr("Cu&t"));
    QAction *copyAction = contextMenu.addAction(tr("&Copy"));
    QAction *pasteAction = contextMenu.addAction(tr("&Paste"));
    contextMenu.addSeparator();
    QMenu *convertMenu = contextMenu.addMenu(tr("Convert To"));
    QAction *renameAction = contextMenu.addAction(tr("Rename..."));
    QAction *removeAction = contextMenu.addAction(tr("Remove"));

    cutAction->setShortcuts(QKeySequence::Cut);
    cutAction->setIcon(QIcon(QLatin1String(":/images/16x16/edit-cut.png")));
    cutAction->setEnabled(customPropertiesSelected && currentObjectHasAllProperties);
    copyAction->setShortcuts(QKeySequence::Copy);
    copyAction->setIcon(QIcon(QLatin1String(":/images/16x16/edit-copy.png")));
    copyAction->setEnabled(customPropertiesSelected && currentObjectHasAllProperties);
    pasteAction->setShortcuts(QKeySequence::Paste);
    pasteAction->setIcon(QIcon(QLatin1String(":/images/16x16/edit-paste.png")));
    pasteAction->setEnabled(ClipboardManager::instance()->hasProperties());
    renameAction->setEnabled(mActionRenameProperty->isEnabled());
    renameAction->setIcon(mActionRenameProperty->icon());
    removeAction->setEnabled(mActionRemoveProperty->isEnabled());
    removeAction->setShortcuts(mActionRemoveProperty->shortcuts());
    removeAction->setIcon(mActionRemoveProperty->icon());

    Utils::setThemeIcon(cutAction, "edit-cut");
    Utils::setThemeIcon(copyAction, "edit-copy");
    Utils::setThemeIcon(pasteAction, "edit-paste");
    Utils::setThemeIcon(removeAction, "remove");


    if (customPropertiesSelected) {
        const int convertTo[] = {
            QVariant::Bool,
            QVariant::Color,
            QVariant::Double,
            filePathTypeId(),
            QVariant::Int,
            QVariant::String
        };

        for (int toType : convertTo) {
            bool someDifferentType = false;
            bool allCanConvert = true;

            for (const QString &propertyName : propertyNames) {
                QVariant propertyValue = object->property(propertyName);

                if (propertyValue.userType() != toType)
                    someDifferentType = true;

                if (!propertyValue.convert(toType)) {
                    allCanConvert = false;
                    break;
                }
            }

            if (someDifferentType && allCanConvert) {
                QAction *action = convertMenu->addAction(typeToName(toType));
                action->setData(toType);
            }
        }
    }

    convertMenu->setEnabled(!convertMenu->actions().isEmpty());

    connect(cutAction, &QAction::triggered, this, &PropertiesDock::cutProperties);
    connect(copyAction, &QAction::triggered, this, &PropertiesDock::copyProperties);
    connect(pasteAction, &QAction::triggered, this, &PropertiesDock::pasteProperties);
    connect(renameAction, &QAction::triggered, this, &PropertiesDock::renameProperty);
    connect(removeAction, &QAction::triggered, this, &PropertiesDock::removeProperties);

    const QPoint globalPos = mPropertyBrowser->mapToGlobal(pos);
    const QAction *selectedItem = contextMenu.exec(globalPos);

    if (selectedItem && selectedItem->parentWidget() == convertMenu) {
        QUndoStack *undoStack = mDocument->undoStack();
        undoStack->beginMacro(tr("Convert Property/Properties", nullptr, items.size()));

        for (const QString &propertyName : propertyNames) {
            QVariant propertyValue = object->property(propertyName);

            int toType = selectedItem->data().toInt();
            propertyValue.convert(toType);

            undoStack->push(new SetProperty(mDocument,
                                            mDocument->currentObjects(),
                                            propertyName, propertyValue));
        }

        undoStack->endMacro();
    }
}