Example #1
0
void MainWindow::createImagesMenu()
{
	QMenu* imagesMenu = menuBar()->addMenu("&Images");

	int interfaceIndex = 0;
	image_interface_iterator iter(m_machine->root_device());
	for (device_image_interface *img = iter.first(); img != NULL; img = iter.next())
	{
		astring menuName;
		menuName.format("%s : %s", img->device().name(), img->exists() ? img->filename() : "[empty slot]");

		QMenu* interfaceMenu = imagesMenu->addMenu(menuName.cstr());
		interfaceMenu->setObjectName(img->device().name());

		QAction* mountAct = new QAction("Mount...", interfaceMenu);
		QAction* unmountAct = new QAction("Unmount", interfaceMenu);
		mountAct->setObjectName("mount");
		mountAct->setData(QVariant(interfaceIndex));
		unmountAct->setObjectName("unmount");
		unmountAct->setData(QVariant(interfaceIndex));
		connect(mountAct, SIGNAL(triggered(bool)), this, SLOT(mountImage(bool)));
		connect(unmountAct, SIGNAL(triggered(bool)), this, SLOT(unmountImage(bool)));

		if (!img->exists())
			unmountAct->setEnabled(false);

		interfaceMenu->addAction(mountAct);
		interfaceMenu->addAction(unmountAct);

		// TODO: Cassette operations

		interfaceIndex++;
	}
}
Example #2
0
void MainWindow::createImagesMenu()
{
	QMenu* imagesMenu = menuBar()->addMenu("&Images");

	int interfaceIndex = 0;
	for (device_image_interface &img : image_interface_iterator(m_machine->root_device()))
	{
		std::string menuName = string_format("%s : %s", img.device().name(), img.exists() ? img.filename() : "[empty slot]");

		QMenu* interfaceMenu = imagesMenu->addMenu(menuName.c_str());
		interfaceMenu->setObjectName(img.device().name());

		QAction* mountAct = new QAction("Mount...", interfaceMenu);
		QAction* unmountAct = new QAction("Unmount", interfaceMenu);
		mountAct->setObjectName("mount");
		mountAct->setData(QVariant(interfaceIndex));
		unmountAct->setObjectName("unmount");
		unmountAct->setData(QVariant(interfaceIndex));
		connect(mountAct, &QAction::triggered, this, &MainWindow::mountImage);
		connect(unmountAct, &QAction::triggered, this, &MainWindow::unmountImage);

		if (!img.exists())
			unmountAct->setEnabled(false);

		interfaceMenu->addAction(mountAct);
		interfaceMenu->addAction(unmountAct);

		// TODO: Cassette operations

		interfaceIndex++;
	}
}
Example #3
0
QList<QAction*> UrlFilter::HotSpot::actions()
{
    QAction* openAction = new QAction(_urlObject);
    QAction* copyAction = new QAction(_urlObject);

    const UrlType kind = urlType();
    Q_ASSERT(kind == StandardUrl || kind == Email);

    if (kind == StandardUrl) {
        openAction->setText(i18n("Open Link"));
        copyAction->setText(i18n("Copy Link Address"));
    } else if (kind == Email) {
        openAction->setText(i18n("Send Email To..."));
        copyAction->setText(i18n("Copy Email Address"));
    }

    // object names are set here so that the hotspot performs the
    // correct action when activated() is called with the triggered
    // action passed as a parameter.
    openAction->setObjectName(QLatin1String("open-action"));
    copyAction->setObjectName(QLatin1String("copy-action"));

    QObject::connect(openAction , SIGNAL(triggered()) , _urlObject , SLOT(activated()));
    QObject::connect(copyAction , SIGNAL(triggered()) , _urlObject , SLOT(activated()));

    QList<QAction*> actions;
    actions << openAction;
    actions << copyAction;

    return actions;
}
Example #4
0
void DkPaintToolBar::createLayout() {

	QList<QKeySequence> enterSc;
	enterSc.append(QKeySequence(Qt::Key_Enter));
	enterSc.append(QKeySequence(Qt::Key_Return));

	QAction* applyAction = new QAction(icons[apply_icon], tr("Apply (ENTER)"), this);
	applyAction->setShortcuts(enterSc);
	applyAction->setObjectName("applyAction");

	QAction* cancelAction = new QAction(icons[cancel_icon], tr("Cancel (ESC)"), this);
	cancelAction->setShortcut(QKeySequence(Qt::Key_Escape));
	cancelAction->setObjectName("cancelAction");

	panAction = new QAction(icons[pan_icon], tr("Pan"), this);
	panAction->setShortcut(QKeySequence(Qt::Key_P));
	panAction->setObjectName("panAction");
	panAction->setCheckable(true);
	panAction->setChecked(false);

	// pen color
	penCol = QColor(0,0,0);
	penColButton = new QPushButton(this);
	penColButton->setObjectName("penColButton");
	penColButton->setStyleSheet("QPushButton {background-color: " + nmc::DkUtils::colorToString(penCol) + "; border: 1px solid #888;}");
	penColButton->setToolTip(tr("Background Color"));
	penColButton->setStatusTip(penColButton->toolTip());

	// undo Button
	undoAction = new QAction(icons[undo_icon], tr("Undo (CTRL+Z)"), this);
	undoAction->setShortcut(QKeySequence::Undo);
	undoAction->setObjectName("undoAction");

	colorDialog = new QColorDialog(this);
	colorDialog->setObjectName("colorDialog");

	// pen width
	widthBox = new QSpinBox(this);
	widthBox->setObjectName("widthBox");
	widthBox->setSuffix("px");
	widthBox->setMinimum(1);
	widthBox->setMaximum(500);	// huge sizes since images might have high resolutions

	// pen alpha
	alphaBox = new QSpinBox(this);
	alphaBox->setObjectName("alphaBox");
	alphaBox->setSuffix("%");
	alphaBox->setMinimum(0);
	alphaBox->setMaximum(100);

	addAction(applyAction);
	addAction(cancelAction);
	addSeparator();
	addAction(panAction);
	addAction(undoAction);
	addSeparator();
	addWidget(widthBox);
	addWidget(penColButton);
	addWidget(alphaBox);
}
Example #5
0
QMenu* Scene_c3t3_item::contextMenu()
{
  const char* prop_name = "Menu modified by Scene_c3t3_item.";

  QMenu* menu = Scene_item::contextMenu();

  // Use dynamic properties:
  // http://doc.qt.io/qt-5/qobject.html#property
  bool menuChanged = menu->property(prop_name).toBool();

  if (!menuChanged) {
    QAction* actionExportFacetsInComplex =
      menu->addAction(tr("Export facets in complex"));
    actionExportFacetsInComplex->setObjectName("actionExportFacetsInComplex");
    connect(actionExportFacetsInComplex,
      SIGNAL(triggered()), this,
      SLOT(export_facets_in_complex()));

    QAction* actionShowSpheres =
      menu->addAction(tr("Show protecting &spheres"));
    actionShowSpheres->setCheckable(true);
    actionShowSpheres->setObjectName("actionShowSpheres");
    connect(actionShowSpheres, SIGNAL(toggled(bool)),
            this, SLOT(show_spheres(bool)));
    menu->setProperty(prop_name, true);
  }
Example #6
0
DnaAssemblySupport::DnaAssemblySupport()
{
    QAction* convertAssemblyToSamAction = new QAction( tr("Convert UGENE assembly database to SAM..."), this );
    convertAssemblyToSamAction->setObjectName(ToolsMenu::NGS_CONVERT_SAM);
    convertAssemblyToSamAction->setIcon(QIcon(":core/images/align.png"));
    connect( convertAssemblyToSamAction, SIGNAL( triggered() ), SLOT( sl_showConvertToSamDialog() ) );
    ToolsMenu::addAction(ToolsMenu::NGS_MENU, convertAssemblyToSamAction);

    QAction* genomeAssemblyAction = new QAction( tr("Genome de novo assembly..."), this );
    genomeAssemblyAction->setObjectName(ToolsMenu::NGS_DENOVO);
    genomeAssemblyAction->setIcon(QIcon(":core/images/align.png"));
    connect( genomeAssemblyAction, SIGNAL( triggered() ), SLOT( sl_showGenomeAssemblyDialog() ) );
    ToolsMenu::addAction(ToolsMenu::NGS_MENU, genomeAssemblyAction);

    QAction* dnaAssemblyAction = new QAction(tr("Map reads to reference..."), this );
    dnaAssemblyAction->setObjectName(ToolsMenu::NGS_MAP);
    dnaAssemblyAction->setIcon(QIcon(":core/images/align.png"));
    connect( dnaAssemblyAction, SIGNAL( triggered() ), SLOT( sl_showDnaAssemblyDialog() ) );
    ToolsMenu::addAction(ToolsMenu::NGS_MENU, dnaAssemblyAction);

    QAction* buildIndexAction = new QAction( tr("Build index for reads mapping..."), this );
    buildIndexAction->setObjectName(ToolsMenu::NGS_INDEX);
    buildIndexAction->setIcon(QIcon(":core/images/align.png"));
    connect( buildIndexAction, SIGNAL( triggered() ), SLOT( sl_showBuildIndexDialog() ) );
    ToolsMenu::addAction(ToolsMenu::NGS_MENU, buildIndexAction);
}
void ModuleDockWidget::contextMenu(QPoint point)
{
    m_point = point;
    QPointer<QMenu> contextMenu = new QMenu(ui->treeView_module);
    contextMenu->setObjectName("contextMenu");

    QAction *actionOpen = new QAction(QIcon::fromTheme("document-open", QIcon(":/icons/16x16/document-open.png")), tr("Open module"), contextMenu);
    actionOpen->setObjectName("actionOpen");
    connect(actionOpen, SIGNAL(triggered()), this, SLOT(open()));

    QAction *actionOpenInNewTab = new QAction(QIcon::fromTheme("tab-new", QIcon(":/icons/16x16/tab-new.png")), tr("Open module in new tab"), contextMenu);
    actionOpenInNewTab->setObjectName("actionPaste");
    connect(actionOpenInNewTab, SIGNAL(triggered()), this, SLOT(openInNewTab()));

    QAction *actionSettings = new QAction(QIcon::fromTheme("configure", QIcon(":/icons/16x16/configure.png")), tr("Configure"), contextMenu);
    actionSettings->setObjectName("actionNew");
    connect(actionSettings, SIGNAL(triggered()), this, SLOT(configure()));



    contextMenu->addAction(actionOpen);
    contextMenu->addAction(actionOpenInNewTab);

    contextMenu->addSeparator();
    contextMenu->addAction(actionSettings);

    contextMenu->exec(QCursor::pos());
    delete contextMenu;
}
Example #8
0
KexiReportView::KexiReportView(QWidget *parent)
        : KexiView(parent)
{
    m_preRenderer = 0;
    setObjectName("KexiReportDesigner_DataView");
    m_scrollArea = new QScrollArea(this);
    m_scrollArea->setBackgroundRole(QPalette::Dark);
    m_scrollArea->viewport()->setAutoFillBackground(true);

    m_pageSelector = new KexiRecordNavigator(this, 0);
    layout()->addWidget(m_scrollArea);
    layout()->addWidget(m_pageSelector);

    m_pageSelector->setRecordCount(0);
    m_pageSelector->setInsertingButtonVisible(false);
    m_pageSelector->setLabelText(i18n("Page"));


    // -- setup local actions
    QList<QAction*> viewActions;
    QAction* a;
    viewActions << (a = new KAction(KIcon("printer"), i18n("Print"), this));
    a->setObjectName("pgzkexirpt_print_report");
    a->setToolTip(i18n("Print Report"));
    a->setWhatsThis(i18n("Prints the current report."));
    connect(a, SIGNAL(triggered()), this, SLOT(slotPrintReport()));

    viewActions << (a = new KAction(KIcon("kword"), i18n("Open in KWord"), this));
    a->setObjectName("pgzkexirpt_open_kword");
    a->setToolTip(i18n("Open the report in KWord"));
    a->setWhatsThis(i18n("Opens the current report in KWord."));
    a->setEnabled(false);
//! @todo connect(a, SIGNAL(triggered()), this, SLOT(slotRenderKWord()));

#ifdef HAVE_KSPREAD
    viewActions << (a = new KAction(KIcon("kspread"), i18n("Open in KSpread"), this));
    a->setObjectName("pgzkexirpt_open_kspread");
    a->setToolTip(i18n("Open the report in KSpread"));
    a->setWhatsThis(i18n("Opens the current report in KSpread."));
    a->setEnabled(true);
    connect(a, SIGNAL(triggered()), this, SLOT(slotRenderKSpread()));
#endif

    viewActions << (a = new KAction(KIcon("text-html"), i18n("Export to HTML"), this));
    a->setObjectName("pgzkexirpt_export_html");
    a->setToolTip(i18n("Export the report to HTML"));
    a->setWhatsThis(i18n("Exports the report to a HTML file."));
    a->setEnabled(true);
    connect(a, SIGNAL(triggered()), this, SLOT(slotExportHTML()));

    setViewActions(viewActions);


    connect(m_pageSelector, SIGNAL(nextButtonClicked()), this, SLOT(nextPage()));
    connect(m_pageSelector, SIGNAL(prevButtonClicked()), this, SLOT(prevPage()));
    connect(m_pageSelector, SIGNAL(firstButtonClicked()), this, SLOT(firstPage()));
    connect(m_pageSelector, SIGNAL(lastButtonClicked()), this, SLOT(lastPage()));

}
Example #9
0
void TextEdit::setupViewActions()
{
    QMenu* menu = new QMenu(tr("&View"), this);
    menuBar()->addMenu(menu);
    actionStatusBar = new QAction(tr("&StatusBar"), this);
    actionStatusBar->setStatusTip(tr("Show or hide the status bar"));
    actionStatusBar->setCheckable(true);
    actionStatusBar->setChecked(true);
    menu->addAction(actionStatusBar);
    connect(actionStatusBar, SIGNAL(triggered()), this, SLOT(hideStatusBar()));

    QMenu* menuToolBars = menu->addMenu(tr("&Toolbars"));
    actionStandardBar = new QAction(tr("Standard"), this);
    connect(actionStandardBar, SIGNAL(triggered()), this, SLOT(standardBar()));
    actionStandardBar->setCheckable(true);
    actionStandardBar->setChecked(true);
    actionStandardBar->setStatusTip(tr("Shows or hides the toolbar"));
    menuToolBars->addAction(actionStandardBar);

    actionFormattingBar = new QAction(tr("Formatting"), this);
    connect(actionFormattingBar, SIGNAL(triggered()), this, SLOT(formattingBar()));
    actionFormattingBar->setStatusTip(tr("Shows or hides the toolbar"));
    actionFormattingBar->setCheckable(true);
    actionFormattingBar->setChecked(true);
    menuToolBars->addAction(actionFormattingBar);

    menu->addSeparator();

    QActionGroup* styleActions = new QActionGroup(this);

    QAction* actionBlue = menu->addAction(tr("Office 2007 Blue"));
    actionBlue->setCheckable(true);
    actionBlue->setChecked(true);
    actionBlue->setObjectName("OS_OFFICE2007BLUE");

    QAction *actionBlack = menu->addAction(tr("Office 2007 Black"));
    actionBlack->setObjectName("OS_OFFICE2007BLACK");
    actionBlack->setCheckable(true);

    QAction* actionSilver = menu->addAction(tr("Office 2007 Silver"));
    actionSilver->setObjectName("OS_OFFICE2007SILVER");
    actionSilver->setCheckable(true);

    QAction* actionAqua = menu->addAction(tr("Office 2007 Aqua"));
    actionAqua->setObjectName("OS_OFFICE2007AQUA");
    actionAqua->setCheckable(true);

    styleActions->addAction(actionBlue);
    styleActions->addAction(actionBlack);
    styleActions->addAction(actionSilver);
    styleActions->addAction(actionAqua);
    connect( styleActions, SIGNAL(triggered(QAction*)), this, SLOT(options(QAction*)) );

    menu->addSeparator();

    QAction* actionCusomize = menu->addAction( tr("Cusomize..."));
    actionCusomize->setEnabled(false);
}
Example #10
0
void MenuExplore::createMenu(){




   /* this->setStyleSheet(QString::fromUtf8("QMenu {\n"
                                          "\n"
                                          "background-color: qlineargradient(spread:pad, x1:0.994318, y1:1, x2:1, y2:0, stop:0.0113636 rgba(146, 169, 211, 255), stop:0.982955 rgba(174, 199, 230, 255));\n"
                                          "border-color: rgb(0, 0, 0);\n"
                                          "}\n"
                                          "QMenu::item {\n"
                                          "background-color: rgb(255, 255, 255);\n"
                                          "}\n"
                                          "QMenu::item:selected {\n"
                                          "background-color: qlineargradient(spread:pad, x1:1, y1:1, x2:1, y2:0, stop:0 rgba(129, 166, 226, 255), stop:1 rgba(93, 131, 190, 255));\n"
                                          "}"));*/


    QMenu* asignar = this->addMenu("Añadir a...");

           QAction *action;



           action = new QAction("Player 1",this);
           action->setObjectName("1"); //para identificar en es cast
           connect(action, SIGNAL(triggered()), explore, SLOT (clickAsignar()));
           asignar->addAction(action);

           action = new QAction("Player 2",this);
           action->setObjectName("2");
           connect(action, SIGNAL(triggered()), explore, SLOT (clickAsignar()));
           asignar->addAction(action);

this->addSeparator();
       action = new QAction("Cortar",this);
       //connect(action, SIGNAL(triggered()), explore, SLOT(addPage()));
       this->addAction(action);


       action = new QAction("Copiar",this);
      // connect(action, SIGNAL(triggered()), explore, SLOT(deletePage()));
       this->addAction(action);


       action = new QAction("Pegar",this);
      // connect(action, SIGNAL(triggered()), explore, SLOT(vaciarPage()));
       this->addAction(action);


this->addSeparator();
              action = new QAction("Eliminar",this);
              //connect(action, SIGNAL(triggered()), explore, SLOT(addPage()));
              this->addAction(action);



}
Example #11
0
void ServiceTree::showServicePopup(const QPoint &iPosition)
{
    emit changeTimer(false);
    //should be Select
    //lastRightClickedItem->setSelected(true);
    itemAt(iPosition)->setSelected(true);
    selectedServices.clear();
    for (int i = 0; i < selectedItems().size(); ++i)
    {
        QTreeWidgetItem *item=selectedItems().at(i);
        QStringList hostAndService;
        hostAndService << item->text(0) << item->text(1);
        qDebug() << "Selected Items  " << hostAndService;
        selectedServices << hostAndService;
    }

    lastRightClickedItem = 0 ;
      lastRightClickedItem = itemAt(iPosition) ;
      if ( 0 == lastRightClickedItem )
      {
        qDebug() << "No item selected" ;
      }
      else
      {
        qDebug() << "Item clicked" + lastRightClickedItem->text(0);

        QMenu menu(this);
        QMenu* hostMenu = new QMenu(this);
        hostMenu->setTitle("&Host");

        //host_state                                    host_state_type                             host_acknowledge (already)
        if ((lastRightClickedItem->text(10) != "0") && (lastRightClickedItem->text(11) != "0") && (lastRightClickedItem->text(12) == "0"))
        {
        QAction *hostAckRightAction   = new QAction("&Acknowledge", this);
            hostAckRightAction->setIcon(QPixmap(ack_xpm));
            hostAckRightAction->setObjectName("HostAcknowledge");
                connect(hostAckRightAction, SIGNAL(triggered(bool)), this, SLOT(menuRightSlot(bool)));
        hostMenu->addAction(hostAckRightAction);
        }

        QAction *hostDowntimeRightAction   = new QAction("&Downtime", this);
            hostDowntimeRightAction->setIcon(QPixmap(downtime_xpm));
            hostDowntimeRightAction->setObjectName("HostDowntime");
                connect(hostDowntimeRightAction, SIGNAL(triggered(bool)), this, SLOT(menuRightSlot(bool)));
        hostMenu->addAction(hostDowntimeRightAction);

        hostMenu->addSeparator();

        // 19 == host_active_checks_enabled
        if (lastRightClickedItem->text(19) == "0")
        {
        QAction *hostEnableActiveChecks   = new QAction("&Enable Active Checks", this);
            hostEnableActiveChecks->setIcon(QIcon(":/images/checks_enabled.png"));
            hostEnableActiveChecks->setObjectName("HostEnableActiveChecks");
                connect(hostEnableActiveChecks, SIGNAL(triggered(bool)), this, SLOT(menuRightSlot(bool)));
        hostMenu->addAction(hostEnableActiveChecks);
        }
Example #12
0
void MenuManager::setup(MenuItem* menuItems) const
{
    if (!menuItems)
        return; // empty menu bar

    QMenuBar* menuBar = getMainWindow()->menuBar();
    //menuBar->setUpdatesEnabled(false);

    QList<MenuItem*> items = menuItems->getItems();
    QList<QAction*> actions = menuBar->actions();
    for (QList<MenuItem*>::ConstIterator it = items.begin(); it != items.end(); ++it)
    {
        // search for the menu action
        QAction* action = findAction(actions, QString::fromAscii((*it)->command().c_str()));
        if (!action) {
            // There must be not more than one separator in the menu bar, so
            // we can safely remove it if available and append it at the end
            if ((*it)->command() == "Separator") {
                action = menuBar->addSeparator();
                action->setObjectName(QLatin1String("Separator"));
            }
            else {
                // create a new menu
                std::string menuName = (*it)->command();
                QMenu* menu = menuBar->addMenu(
                    QApplication::translate("Workbench", menuName.c_str(),
                                            0, QApplication::UnicodeUTF8));
                action = menu->menuAction();
                menu->setObjectName(QString::fromAscii(menuName.c_str()));
                action->setObjectName(QString::fromAscii(menuName.c_str()));
            }

            // set the menu user data
            action->setData(QString::fromAscii((*it)->command().c_str()));
        }
        else {
            // put the menu at the end
            menuBar->removeAction(action);
            menuBar->addAction(action);
            action->setVisible(true);
            int index = actions.indexOf(action);
            actions.removeAt(index);
        }

        // flll up the menu
        if (!action->isSeparator())
            setup(*it, action->menu());
    }

    // hide all menus which we don't need for the moment
    for (QList<QAction*>::Iterator it = actions.begin(); it != actions.end(); ++it) {
        (*it)->setVisible(false);
    }

    // enable update again
    //menuBar->setUpdatesEnabled(true);
}
void QgsRasterTerrainAnalysisPlugin::initGui()
{
  //create Action
  if ( mIface )
  {
    //find raster menu
    QString rasterText = QCoreApplication::translate( "QgisApp", "&Raster" );
    QMainWindow* mainWindow = qobject_cast<QMainWindow*>( mIface->mainWindow() );
    if ( !mainWindow )
    {
      return;
    }

    QMenuBar* menuBar = mainWindow->menuBar();
    if ( !menuBar )
    {
      return;
    }

    QMenu* rasterMenu = 0;
    QList<QAction *> menuBarActions = menuBar->actions();
    QList<QAction *>::iterator menuActionIt =  menuBarActions.begin();
    for ( ; menuActionIt != menuBarActions.end(); ++menuActionIt )
    {
      if (( *menuActionIt )->menu() && ( *menuActionIt )->menu()->title() == rasterText )
      {
        rasterMenu = ( *menuActionIt )->menu();
        rasterMenu->addSeparator();
        break;
      }
    }

    if ( !rasterMenu )
    {
      return;
    }

    mTerrainAnalysisMenu = new QMenu( tr( "Terrain analysis" ), rasterMenu );
    mTerrainAnalysisMenu->setObjectName( "mTerrainAnalysisMenu" );
    mTerrainAnalysisMenu->setIcon( QIcon( ":/raster/dem.png" ) );
    QAction *slopeAction = mTerrainAnalysisMenu->addAction( tr( "Slope" ), this, SLOT( slope() ) );
    slopeAction->setObjectName( "slopeAction" );

    QAction *aspectAction = mTerrainAnalysisMenu->addAction( tr( "Aspect" ), this, SLOT( aspect() ) );
    aspectAction->setObjectName( "aspectAction" );
    QAction *hilshadeAction = mTerrainAnalysisMenu->addAction( tr( "Hillshade" ), this, SLOT( hillshade() ) );
    hilshadeAction->setObjectName( "hilshadeAction" );
    QAction *reliefAction = mTerrainAnalysisMenu->addAction( tr( "Relief" ), this, SLOT( relief() ) );
    reliefAction->setObjectName( "reliefAction" );
    QAction *ruggednesIndex = mTerrainAnalysisMenu->addAction( tr( "Ruggedness index" ), this, SLOT( ruggedness() ) );
    ruggednesIndex->setObjectName( "ruggednesIndex" );

    rasterMenu->addMenu( mTerrainAnalysisMenu );


  }
}
Example #14
0
KexiReportView::KexiReportView(QWidget *parent)
        : KexiView(parent), m_preRenderer(0), m_reportDocument(0), m_kexi(0), m_functions(0)
{   
    setObjectName("KexiReportDesigner_DataView");
    m_scrollArea = new QScrollArea(this);
    m_scrollArea->setBackgroundRole(QPalette::Dark);
    m_scrollArea->viewport()->setAutoFillBackground(true);

    layout()->addWidget(m_scrollArea);
    
#ifndef KEXI_MOBILE
    m_pageSelector = new KexiRecordNavigator(this, 0);
    layout()->addWidget(m_pageSelector);
    m_pageSelector->setRecordCount(0);
    m_pageSelector->setInsertingButtonVisible(false);
    m_pageSelector->setLabelText(i18n("Page"));
#endif
    
    // -- setup local actions
    QList<QAction*> viewActions;
    QAction* a;
    viewActions << (a = new KAction(KIcon("printer"), i18n("Print"), this));
    a->setObjectName("print_report");
    a->setToolTip(i18n("Print Report"));
    a->setWhatsThis(i18n("Prints the current report."));
    connect(a, SIGNAL(triggered()), this, SLOT(slotPrintReport()));

    viewActions << (a = new KAction(KIcon("kword"), i18n("Save to KWord"), this));
    a->setObjectName("save_to_kword");
    a->setToolTip(i18n("Save the report to a KWord document"));
    a->setWhatsThis(i18n("Save the report to a KWord document"));
    a->setEnabled(true);
    connect(a, SIGNAL(triggered()), this, SLOT(slotRenderODT()));

    viewActions << (a = new KAction(KIcon("kspread"), i18n("Save to KSpread"), this));
    a->setObjectName("save_to_kspread");
    a->setToolTip(i18n("Save the report to a KSpread document"));
    a->setWhatsThis(i18n("Saves the current report to a KSpread document."));
    a->setEnabled(true);
    connect(a, SIGNAL(triggered()), this, SLOT(slotRenderKSpread()));

    viewActions << (a = new KAction(KIcon("text-html"), i18n("Export as Web Page"), this));
    a->setObjectName("export_as_web_page");
    a->setToolTip(i18n("Export the report as web page"));
    a->setWhatsThis(i18n("Exports the report to a web page file."));
    a->setEnabled(true);
    connect(a, SIGNAL(triggered()), this, SLOT(slotExportHTML()));

    setViewActions(viewActions);

#ifndef KEXI_MOBILE
    connect(m_pageSelector, SIGNAL(nextButtonClicked()), this, SLOT(nextPage()));
    connect(m_pageSelector, SIGNAL(prevButtonClicked()), this, SLOT(prevPage()));
    connect(m_pageSelector, SIGNAL(firstButtonClicked()), this, SLOT(firstPage()));
    connect(m_pageSelector, SIGNAL(lastButtonClicked()), this, SLOT(lastPage()));
#endif
}
Example #15
0
void
MidiProgramsEditor::slotKeyMapButtonPressed()
{
    QToolButton* button = dynamic_cast<QToolButton*>(const_cast<QObject *>(sender()));
    if (!button) {
        RG_DEBUG << "MidiProgramsEditor::slotKeyMapButtonPressed() : %%% ERROR - signal sender is not a QPushButton\n";
        return ;
    }

//    std::cout << "editor button name" << button->objectName().toStdString() << std::endl;

    QString senderName = button->objectName();

    if (!m_device)
        return ;

    const KeyMappingList &kml = m_device->getKeyMappings();
    if (kml.empty())
        return ;

    // Adjust value back to zero rated
    //
    unsigned int id = senderName.toUInt() - 1;
    MidiProgram *program = getProgram(*getCurrentBank(), id);
    if (!program)
        return ;
    m_currentMenuProgram = id;

    RosegardenPopupMenu *menu = new RosegardenPopupMenu(button);

    const MidiKeyMapping *currentMapping =
        m_device->getKeyMappingForProgram(*program);

    int currentKeyMap = 0;

    QAction *a = menu->addAction(tr("<no key mapping>"));
    a->setObjectName("0");

    for (size_t i = 0; i < kml.size(); ++i) {
        a = menu->addAction(strtoqstr(kml[i].getName()));
        a->setObjectName(QString("%1").arg(i+1));
        if (currentMapping && (kml[i] == *currentMapping)) currentKeyMap = int(i + 1);
    }

    connect(menu, SIGNAL(triggered(QAction *)),
            this, SLOT(slotKeyMapMenuItemSelected(QAction *)));

    int itemHeight = menu->actionGeometry(actions().value(0)).height() + 2;
    QPoint pos = QCursor::pos();

    pos.rx() -= 10;
    pos.ry() -= (itemHeight / 2 + currentKeyMap * itemHeight);

    menu->popup(pos);
}
Example #16
0
void ServiceTree::showServicePopup(const QPoint &iPosition)
{
    lastRightClickedItem = 0 ;
    lastRightClickedItem = itemAt(iPosition) ;
    if ( 0 == lastRightClickedItem )
    {
        qDebug() << "No item selected" ;
    }
    else
    {
        qDebug() << "Item clicked" + lastRightClickedItem->text(0);
        QMenu menu(this);
        QMenu* serviceMenu = new QMenu(this);
        serviceMenu->setTitle("&Service");

        QAction *reschedRightAction   = new QAction("&Reschedule", this);
        reschedRightAction->setIcon(QPixmap(reschedule_xpm));
        reschedRightAction->setObjectName("Reschedule");
        connect(reschedRightAction, SIGNAL(triggered(bool)), this, SLOT(menuRightSlot(bool)));
        serviceMenu->addAction(reschedRightAction);

        // not soft and not ack and not ok
        if ((lastRightClickedItem->text(4) != "0") && (lastRightClickedItem->text(5) == "0") && (lastRightClickedItem->text(2) != "0"))
        {
            QAction *ackRightAction   = new QAction("&Acknowledge", this);
            ackRightAction->setIcon(QPixmap(ack_xpm));
            ackRightAction->setObjectName("Acknowledge");
            connect(ackRightAction, SIGNAL(triggered(bool)), this, SLOT(menuRightSlot(bool)));
            serviceMenu->addAction(ackRightAction);
        }

        QAction *downtimeRightAction   = new QAction("&Downtime", this);
        downtimeRightAction->setIcon(QPixmap(downtime_xpm));
        downtimeRightAction->setObjectName("Downtime");
        connect(downtimeRightAction, SIGNAL(triggered(bool)), this, SLOT(menuRightSlot(bool)));
        serviceMenu->addAction(downtimeRightAction);

        QMenu* contactMenu = new QMenu(this);
        contactMenu->setTitle("Contacts");
        QStringList list = lastRightClickedItem->text(15).split(',');
        for (int i = 0; i < list.size(); ++i)
        {
            QAction* cAction = new QAction(list.at(i), this);
            cAction->setEnabled(false);
            contactMenu->addAction(cAction);
        }

        menu.addMenu(serviceMenu);
        menu.addSeparator();
        menu.addMenu(contactMenu);

        menu.exec(mapToGlobal(iPosition));
    }
QMenu* Scene_combinatorial_map_item::contextMenu()
{
    const char* prop_name = "Menu modified by Scene_combinatorial_map_item.";

    QMenu* menu = Scene_item::contextMenu();

    // Use dynamic properties:
    // http://doc.qt.io/qt-5/qobject.html#property
    bool menuChanged = menu->property(prop_name).toBool();

    if(!menuChanged) {
        QAction* actionSelectNextVolume =
                menu->addAction(tr("Iterate over volumes"));
        actionSelectNextVolume->setObjectName("actionSelectNextVolume");
        connect(actionSelectNextVolume, SIGNAL(triggered()),this, SLOT(set_next_volume()));

        exportSelectedVolume =
                menu->addAction(tr("Export current volume as polyhedron"));
        exportSelectedVolume->setObjectName("exportSelectedVolume");
        connect(exportSelectedVolume, SIGNAL(triggered()),this, SLOT(export_current_volume_as_polyhedron()));
        exportSelectedVolume->setEnabled(volume_to_display!=0);
        menu->setProperty(prop_name, true);

        if(is_from_corefinement()){
            //Export union as polyhedron
            QAction* exportUnion =
                    menu->addAction(tr("Export union as polyhedron"));
            exportUnion->setObjectName("exportUnion");
            connect(exportUnion, SIGNAL(triggered()),this, SLOT(export_union_as_polyhedron()));

            //Export intersection as polyhedron
            QAction* exportIntersection =
                    menu->addAction(tr("Export intersection as polyhedron"));
            exportIntersection->setObjectName("exportIntersection");
            connect(exportIntersection, SIGNAL(triggered()),this, SLOT(export_intersection_as_polyhedron()));

            //Export A minus B as polyhedron
            QAction* exportAMinusB =
                    menu->addAction(tr("Export A minus B as polyhedron"));
            exportAMinusB->setObjectName("exportAMinusB");
            connect(exportAMinusB, SIGNAL(triggered()),this, SLOT(export_A_minus_B_as_polyhedron()));

            //Export B minus A as polyhedron
            QAction* exportBMinusA =
                    menu->addAction(tr("Export B minus A as polyhedron"));
            exportBMinusA->setObjectName("exportBMinusA");
            connect(exportBMinusA, SIGNAL(triggered()),this, SLOT(export_B_minus_A_as_polyhedron()));

        }
    }
    return menu;
}
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 #19
0
BreakpointsWindow::BreakpointsWindow(running_machine* machine, QWidget* parent) :
	WindowQt(machine, nullptr)
{
	setWindowTitle("Debug: All Breakpoints");

	if (parent != nullptr)
	{
		QPoint parentPos = parent->pos();
		setGeometry(parentPos.x()+100, parentPos.y()+100, 800, 400);
	}

	//
	// The main frame and its input and breakpoints widgets
	//
	QFrame* mainWindowFrame = new QFrame(this);

	// The main breakpoints view
	m_breakpointsView = new DebuggerView(DVT_BREAK_POINTS, m_machine, this);

	// Layout
	QVBoxLayout* vLayout = new QVBoxLayout(mainWindowFrame);
	vLayout->setObjectName("vlayout");
	vLayout->setSpacing(3);
	vLayout->setContentsMargins(2,2,2,2);
	vLayout->addWidget(m_breakpointsView);

	setCentralWidget(mainWindowFrame);

	//
	// Menu bars
	//
	QActionGroup* typeGroup = new QActionGroup(this);
	typeGroup->setObjectName("typegroup");
	QAction* typeBreak = new QAction("Breakpoints", this);
	typeBreak->setObjectName("typebreak");
	QAction* typeWatch = new QAction("Watchpoints", this);
	typeWatch->setObjectName("typewatch");
	typeBreak->setCheckable(true);
	typeWatch->setCheckable(true);
	typeBreak->setActionGroup(typeGroup);
	typeWatch->setActionGroup(typeGroup);
	typeBreak->setShortcut(QKeySequence("Ctrl+1"));
	typeWatch->setShortcut(QKeySequence("Ctrl+2"));
	typeBreak->setChecked(true);
	connect(typeGroup, &QActionGroup::triggered, this, &BreakpointsWindow::typeChanged);

	// Assemble the options menu
	QMenu* optionsMenu = menuBar()->addMenu("&Options");
	optionsMenu->addActions(typeGroup->actions());
}
Example #20
0
void SxEditor::on_editor_contextMenu( QMenu* menu, bool *pbContinue )
{
	KMenu *pMenu = qobject_cast<KMenu*>(menu);
	{
		QAction *action = pMenu->addAction("粗体", this, SLOT(on_common_command_clicked()));
		action->setObjectName("bold");
	}
	{
		QAction *action = pMenu->addAction("斜体", this, SLOT(on_common_command_clicked()));
		action->setObjectName("italic");
	}
	{
		QAction *action = pMenu->addAction("下划线", this, SLOT(on_common_command_clicked()));
		action->setObjectName("underline");
	}
	{
		QAction *action = pMenu->addAction("删除线", this, SLOT(on_common_command_clicked()));
		action->setObjectName("throughout");
	}
	{
		QAction *action = menu->addSeparator();
	}

	{
		QAction *action = menu->addAction("选择全部", this, SLOT(on_common_command_clicked()));
		action->setObjectName("selectAll");
	}

	{
		QAction *action = menu->addAction("粘贴", this, SLOT(on_common_command_clicked()));
		bool bEnable = false;
		QClipboard *clipboard = QApplication::clipboard();
		if(clipboard )
		{
			const QMimeData *mimedata = clipboard->mimeData();
			if (mimedata->hasHtml() || mimedata->hasImage() || mimedata->hasText() || mimedata->hasUrls() || mimedata->hasFormat(KTextEditMime))
			{
				bEnable = true;
			}
		}
		action->setEnabled(bEnable && !m_pTextEdit->isReadOnly());
		action->setObjectName("paste");
	}

	QTextCursor cursor = m_pTextEdit->textCursor();
	bool hasText = !cursor.selection().isEmpty();
	{
		QAction *action = menu->addAction("剪切", this, SLOT(on_common_command_clicked()));
		action->setEnabled(hasText && !m_pTextEdit->isReadOnly());
		action->setObjectName("cut");
	}

	{
		QAction *action = menu->addAction("复制", this, SLOT(on_common_command_clicked()));
		action->setEnabled(hasText);
		action->setObjectName("copy");
	}
	*pbContinue  = false;
}
Example #21
0
PreviewActionGroup::PreviewActionGroup(QDesignerFormEditorInterface *core, QObject *parent) :
    QActionGroup(parent),
    m_core(core)
{
    /* Create a list of up to MaxDeviceActions invisible actions to be
     * populated with device profiles (actiondata: index) followed by the
     * standard style actions (actiondata: style name). */
    connect(this, SIGNAL(triggered(QAction*)), this, SLOT(slotTriggered(QAction*)));
    setExclusive(true);

    const QString objNamePostfix = QStringLiteral("_action");
    // Create invisible actions for devices. Set index as action data.
    QString objNamePrefix = QStringLiteral("__qt_designer_device_");
    for (int i = 0; i < MaxDeviceActions; i++) {
        QAction *a = new QAction(this);
        QString objName = objNamePrefix;
        objName += QString::number(i);
        objName += objNamePostfix;
        a->setObjectName(objName);
        a->setVisible(false);
        a->setData(i);
        addAction(a);
    }
    // Create separator at index MaxDeviceActions
    QAction *sep = new QAction(this);
    sep->setObjectName(QStringLiteral("__qt_designer_deviceseparator"));
    sep->setSeparator(true);
    sep->setVisible(false);
    addAction(sep);
    // Populate devices
    updateDeviceProfiles();

    // Add style actions
    const QStringList styles = QStyleFactory::keys();
    const QStringList::const_iterator cend = styles.constEnd();
    // Make sure ObjectName  is unique in case toolbar solution is used.
    objNamePrefix = QStringLiteral("__qt_designer_style_");
    // Create styles. Set style name string as action data.
    for (QStringList::const_iterator it = styles.constBegin(); it !=  cend ;++it) {
        QAction *a = new QAction(tr("%1 Style").arg(*it), this);
        QString objName = objNamePrefix;
        objName += *it;
        objName += objNamePostfix;
        a->setObjectName(objName);
        a->setData(*it);
        addAction(a);
    }
}
SequenceObjectContext::SequenceObjectContext (U2SequenceObject* obj, QObject* parent)
    : QObject(parent),
      seqObj(obj),
      aminoTT(NULL),
      complTT(NULL),
      selection(NULL),
      translations(NULL),
      visibleFrames(NULL),
      rowChoosed(false)
{
    selection = new DNASequenceSelection(seqObj, this);
    clarifyAminoTT = false;
    const DNAAlphabet* al  = getAlphabet();
    if (al->isNucleic()) {
        DNATranslationRegistry* translationRegistry = AppContext::getDNATranslationRegistry();
        complTT = GObjectUtils::findComplementTT(seqObj->getAlphabet());
        aminoTT = GObjectUtils::findAminoTT(seqObj, true);
        clarifyAminoTT = aminoTT == NULL;

        QList<DNATranslation*> aminoTs = translationRegistry->lookupTranslation(al, DNATranslationType_NUCL_2_AMINO);
        if (!aminoTs.empty()) {
            aminoTT = aminoTT == NULL ? translationRegistry->getStandardGeneticCodeTranslation(al) : aminoTT;
            translations = new QActionGroup(this);
            foreach(DNATranslation* t, aminoTs) {
                QAction* a = translations->addAction(t->getTranslationName());
                a->setObjectName(t->getTranslationName());
                a->setCheckable(true);
                a->setChecked(aminoTT == t);
                a->setData(QVariant(t->getTranslationId()));
                connect(a, SIGNAL(triggered()), SLOT(sl_setAminoTranslation()));
            }
Example #23
0
void ActionEditor::slotNewAction()
{
    NewActionDialog dlg(this);
    dlg.setWindowTitle(tr("New action"));

    if (dlg.exec() == QDialog::Accepted) {
        const ActionData actionData = dlg.actionData();
        m_actionView->clearSelection();
        QAction *action = new QAction(formWindow());
        action->setObjectName(actionData.name);
        formWindow()->ensureUniqueObjectName(action);
        action->setText(actionData.text);

        QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension*>(core()->extensionManager(), action);
        if (!actionData.toolTip.isEmpty())
            setInitialProperty(sheet, QLatin1String(toolTipPropertyC), actionData.toolTip);

        if (actionData.checkable)
            setInitialProperty(sheet, QLatin1String(checkablePropertyC), QVariant(true));

        if (!actionData.keysequence.value().isEmpty())
            setInitialProperty(sheet, QLatin1String(shortcutPropertyC), QVariant::fromValue(actionData.keysequence));

        sheet->setProperty(sheet->indexOf(QLatin1String(iconPropertyC)), QVariant::fromValue(actionData.icon));

        AddActionCommand *cmd = new AddActionCommand(formWindow());
        cmd->init(action);
        formWindow()->commandHistory()->push(cmd);
    }
}
// Create an action
static inline QAction *createAction(QObject *parent, const QString &name, const QString &icon,
                                    const QString &actionName,
                                    const Core::Context &context,
                                    const QString &trans, const QString &transContext,
                                    Core::Command *cmd,
                                    Core::ActionContainer *menu,
                                    const QString &group,
                                    QKeySequence::StandardKey key = QKeySequence::UnknownKey,
                                    bool checkable = false)
{
    QAction *a = new QAction(parent);
    a->setObjectName(name);
    if (!icon.isEmpty())
        a->setIcon(theme()->icon(icon));
    if (checkable) {
        a->setCheckable(true);
        a->setChecked(false);
    }
    cmd = actionManager()->registerAction(a, Core::Id(actionName), context);
    if (!transContext.isEmpty())
        cmd->setTranslations(trans, trans, transContext);
    else
        cmd->setTranslations(trans, trans); // use the Trans::Constants tr context (automatic)
    if (key != QKeySequence::UnknownKey)
        cmd->setDefaultKeySequence(key);
    if (menu)
        menu->addAction(cmd, Core::Id(group));
    return a;
}
Example #25
0
QMenu* Scene_polylines_item::contextMenu() 
{
    const char* prop_name = "Menu modified by Scene_polylines_item.";

    QMenu* menu = Scene_item::contextMenu();

    // Use dynamic properties:
    // http://doc.qt.io/qt-5/qobject.html#property
    bool menuChanged = menu->property(prop_name).toBool();

    if(!menuChanged) {
        menu->addSeparator();
        // TODO: add actions to display corners
        QAction* action = menu->addAction(tr("Display corners with radius..."));
        connect(action, SIGNAL(triggered()),
                this, SLOT(change_corner_radii()));

        QAction* actionSmoothPolylines =
                menu->addAction(tr("Smooth polylines"));
        actionSmoothPolylines->setObjectName("actionSmoothPolylines");
        connect(actionSmoothPolylines, SIGNAL(triggered()),this, SLOT(smooth()));
        menu->setProperty(prop_name, true);
    }
    return menu;
}
Example #26
0
void CActions::createAction(const QString& shortCut,
const char * icon,
const QString& name,
const QString& actionName,
const QString& toolTip)
{
    if (findChild<QAction *> (actionName))
    {
        qDebug() << tr("Action with the name '%1' already registered. Please choose another name.").arg(actionName);
        return;
    }

    QAction *tmpAction = new QAction(QIcon(icon), name, this);
    tmpAction->setObjectName(actionName);
    tmpAction->setShortcut(shortCut);
    tmpAction->setToolTip(toolTip);

    QString slotName;
    if (actionName.startsWith('a'))
    {
        slotName = "func" + actionName.mid(1);
    }
    else
    {
        slotName = actionName;
    }

    connect(tmpAction, SIGNAL(triggered()), this, QString("1" + slotName + "()").toLatin1().data());

}
Example #27
0
QList< QAction * > Inputs::getAddActions()
{
	QAction *actCD = new QAction( NULL );
	actCD->setObjectName( "actCD" );
	actCD->setIcon( QIcon( ":/cd" ) );
	actCD->setText( tr( "Płyta AudioCD" ) );
	actCD->connect( actCD, SIGNAL( triggered() ), this, SLOT( add() ) );

	QAction *actTone = new QAction( NULL );
	actTone->setObjectName( "actTone" );
	actTone->setIcon( QIcon( ":/sine" ) );
	actTone->setText( tr( "Generator częstotliwości" ) );
	actTone->connect( actTone, SIGNAL( triggered() ), this, SLOT( add() ) );

	return QList< QAction * >() << actCD << actTone;
}
Example #28
0
void FolderMenu::createCreateNewMenu() {
  QMenu* createMenu = new QMenu(this);
  createNewMenu_ = createMenu;

  QAction* action = new QAction(tr("Folder"), this);
  connect(action, SIGNAL(triggered(bool)), SLOT(onCreateNewFolder()));
  createMenu->addAction(action);

  action = new QAction(tr("Blank File"), this);
  connect(action, SIGNAL(triggered(bool)), SLOT(onCreateNewFile()));
  createMenu->addAction(action);

  // add more items to "Create New" menu from templates
  GList* templates = fm_template_list_all(fm_config->only_user_templates);
  if(templates) {
    createMenu->addSeparator();
    for(GList* l = templates; l; l = l->next) {
      FmTemplate* templ = (FmTemplate*)l->data;
      /* we support directories differently */
      if(fm_template_is_directory(templ))
        continue;
      FmMimeType* mime_type = fm_template_get_mime_type(templ);
      const char* label = fm_template_get_label(templ);
      QString text = QString("%1 (%2)").arg(QString::fromUtf8(label)).arg(QString::fromUtf8(fm_mime_type_get_desc(mime_type)));
      FmIcon* icon = fm_template_get_icon(templ);
      if(!icon)
        icon = fm_mime_type_get_icon(mime_type);
      QAction* action = createMenu->addAction(IconTheme::icon(icon), text);
      action->setObjectName(QString::fromUtf8(fm_template_get_name(templ, NULL)));
      connect(action, SIGNAL(triggered(bool)), SLOT(onCreateNew()));
    }
  }
}
Example #29
0
QAction* ModuleUploader::initModuleAction()
{
    QAction *act = new QAction(QObject::tr("Upload"), 0);
    act->setObjectName("actUpload");
    connect(act, &QAction::triggered, this, &ModuleUploader::init);
    return act;
}
Example #30
0
QAction* CWizActions::addAction(WIZACTION& action)
{
    QString strText = action.strText;
    QString strIconName = action.strName;
    QString strShortcut = action.strShortcut;
    QString strSlot = "1on_" + action.strName + "_triggered()";

    QAction* pAction = new QAction(strText, m_parent);

    if (!strIconName.isEmpty()) {
        pAction->setIcon(::WizLoadSkinIcon(m_app.userSettings().skin(), QColor(0xff, 0xff, 0xff), strIconName));
    }

    if (!strShortcut.isEmpty()) {
        pAction->setShortcut(QKeySequence(strShortcut));
    }

    if (action.strName == "actionAbout")
        pAction->setMenuRole(QAction::AboutRole);
    else if (action.strName == "actionPreference")
        pAction->setMenuRole(QAction::PreferencesRole);
    else if (action.strName == "actionExit")
        pAction->setMenuRole(QAction::QuitRole);

    // Used for building menu from ini file
    pAction->setObjectName(action.strName);

    m_actions[action.strName] = pAction;
    QObject::connect(pAction, "2triggered()", m_parent, strSlot.toUtf8());

    return pAction;
}