Example #1
0
bool EditorFrame::addClassViewContextMenuAddActions(bool clearMenu)
{
  bool success = false;

  if(!mContextMenu){
    return success;
  }

  if(clearMenu){
    mContextMenu->clear();
  }

  openstudio::IddFile iddFile = mModelExplorer->getIddFile();
  std::string group;
  std::vector<std::string> groups = iddFile.groups();
  openstudio::IddObject object;
  std::vector<openstudio::IddObject> objects;

  QAction * newAddAction = nullptr;
  QString name;
  QString string;
  QMenu * addSubMenu = nullptr;

  for(unsigned i=0 ; i<groups.size(); i++){
    group = groups.at(i);
    objects = iddFile.getObjectsInGroup(group);
    QMenu * subMenu = new QMenu(group.c_str());
    subMenu->setIcon(QIcon(":/images/edit_add.png"));
    for(unsigned j=0 ; j<objects.size(); j++){
      object = objects.at(j);
      name = object.name().c_str();
      string = mActionDescriptionPrefix + name;
      newAddAction = new QAction(QIcon(":/images/edit_add.png"), tr(string.toStdString().c_str()), this);
      ///! No connection required as the context menu will always call addObject()
      ///! Context menu signal has QAction->text() to pass to addObject()
      subMenu->addAction(newAddAction);
    }
    if(objects.size() && subMenu){
      if(!success){
        addSubMenu = new QMenu(tr("Add"));
        addSubMenu->setIcon(QIcon(":/images/edit_add.png"));
        OS_ASSERT(addSubMenu);
        mContextMenu->addMenu(addSubMenu);
        success = true;
      }
      addSubMenu->addMenu(subMenu);
    }
  }

  if(!success){
    QAction * inactiveAddAction = new QAction(QIcon(":/images/edit_add_off.png"), tr("Nothing available to add to this object"), this);
    mContextMenu->addAction(inactiveAddAction);
    success = true;
  }

  return success;
}
Example #2
0
void Monitor::initMenu()
{
	/* Menu bar */
	Q_ASSERT(layout() != NULL);
	layout()->setMenuBar(new QMenuBar(this));
	
	/* Universe menu */
	QMenu* universeMenu = new QMenu(layout()->menuBar());
	universeMenu->setTitle(tr("Universe"));
	qobject_cast <QMenuBar*> (layout()->menuBar())->addMenu(universeMenu);
	QListIterator <QAction*> it(m_universeActions);
	while (it.hasNext() == true)
		universeMenu->addAction(it.next());

	/* Display menu */
	QMenu* displayMenu = new QMenu(layout()->menuBar());
	displayMenu->setTitle("Display");
	qobject_cast <QMenuBar*> (layout()->menuBar())->addMenu(displayMenu);
	displayMenu->addAction(m_fontAction);
	displayMenu->addSeparator();

	/* Update speed (inside display menu) */
	QMenu* speedMenu = new QMenu(displayMenu);
	displayMenu->addMenu(speedMenu);
	speedMenu->setTitle("Update speed");
	speedMenu->setIcon(QIcon(":/clock.png"));
	speedMenu->addAction(m_16HzAction);
	speedMenu->addAction(m_32HzAction);
	speedMenu->addAction(m_64HzAction);

	connect(universeMenu, SIGNAL(triggered(QAction*)),
		this, SLOT(slotUniverseTriggered(QAction*)));
}
Example #3
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 #4
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 #5
0
void TrayMenu::changeState(int state){
	static int phase = 1;
	RTorrent * torrent = dynamic_cast<RTorrent *>(sender());
	if(!torrent) return;
	QMenu * tmenu = torrents[torrent->getId()];
	if(torrent->getState())
		tmenu->setIcon(QIcon(":/img/open.png")); 
	else
		tmenu->setIcon(QIcon(":/img/close.png")); 

	if(torrent->isHashChecking())
	{
		phase=phase?0:1;
		tmenu->setIcon(QIcon(QString(":/img/rehash%1.png").arg(phase)));
	}
	
}
Example #6
0
QMenu* DragLabel::rightClickMenu()
{
  if (!m_RightClickMenu) {
    m_RightClickMenu = new QMenu(this);
    QMenu* colorMenu = new QMenu("Color", this);
    colorMenu->setIcon(QIcon(":/icons/color.svg"));
    QActionGroup* colorGroup = new QActionGroup(this);
    pRedColorAction = new QAction(QIcon(":/icons/red.svg"), tr("&Red"), this);
    pRedColorAction->setCheckable(true);
    if(currentColor()== Qt::red)
        pRedColorAction->setChecked(true);

    pOrangeColorAction = new QAction(QIcon(":/icons/orange.svg"), tr("&Orange"), this);
    pOrangeColorAction->setCheckable(true);
    if(currentColor() == QColor(254,154,46))
        pOrangeColorAction->setChecked(true);

    pGreenColorAction = new QAction(QIcon(":/icons/green.svg"), tr("&Green"), this);
    pGreenColorAction->setCheckable(true);
    if(currentColor()== Qt::green)
        pGreenColorAction->setChecked(true);

    pWhiteColorAction = new QAction(QIcon(":/icons/white.svg"), tr("&White"), this);
    pWhiteColorAction->setCheckable(true);
    if(currentColor()== Qt::white)
        pWhiteColorAction->setChecked(true);

    pGrayColorAction = new QAction(QIcon(":/icons/gray.svg"), tr("&Gray"), this);
    pGrayColorAction->setCheckable(true);
    if(currentColor()== Qt::lightGray)
        pGrayColorAction->setChecked(true);

    //group
    colorGroup->addAction(pRedColorAction);
    colorGroup->addAction(pOrangeColorAction);
    colorGroup->addAction(pGreenColorAction);
    colorGroup->addAction(pWhiteColorAction);
    colorGroup->addAction(pGrayColorAction);
    colorGroup->setExclusive(true);
    connect(colorGroup,SIGNAL(triggered(QAction *)),this,SLOT(changeColorSlot(QAction*)));

    //menu
    colorMenu->addAction(pRedColorAction);
    colorMenu->addAction(pOrangeColorAction);
    colorMenu->addAction(pGreenColorAction);
    colorMenu->addSeparator();
    colorMenu->addAction(pWhiteColorAction);
    colorMenu->addAction(pGrayColorAction);

    QAction* pDeleteAction = new QAction(QIcon(":/icons/delete.svg"), tr("&Delete"), this);
    connect(pDeleteAction,SIGNAL(triggered()),this,SLOT(deleteItemSlot()));


    m_RightClickMenu->addMenu(colorMenu);
    m_RightClickMenu->addAction(pDeleteAction);
  }
Example #7
0
void PhotoDialog::photoTreeWidgetCustomPopupMenu( QPoint point )
{

      QMenu contextMnu( this );
      QMouseEvent *mevent = new QMouseEvent( QEvent::MouseButtonPress, point, Qt::RightButton, Qt::RightButton, Qt::NoModifier );
      
      QAction *openphotoAct = new QAction(QIcon(":/images/openimage.png"), tr( "Open" ), this );
      openphotoAct->setShortcut(Qt::CTRL + Qt::Key_O);
      connect( openphotoAct , SIGNAL( triggered(QTreeWidgetItem * , int) ), this, SLOT( showPhoto( QTreeWidgetItem *, int ) ) );

      QAction *removephotoAct = new QAction(QIcon(IMAGE_REMOVE), tr( "Remove" ), this );
      removephotoAct->setShortcut(Qt::Key_Delete);
      connect( removephotoAct , SIGNAL( triggered() ), this, SLOT( removePhoto() ) );
      
      rateExcellenAct = new QAction(QIcon(":/images/rate-5.png"), tr("Excellent"), this);
      rateExcellenAct->setShortcut(Qt::CTRL + Qt::Key_5);
      connect(rateExcellenAct, SIGNAL(triggered()), this, SLOT(rateExcellent()));
      
      rateGoodAct = new QAction(QIcon(":/images/rate-4.png"), tr("Good"), this);
      rateGoodAct->setShortcut(Qt::CTRL + Qt::Key_4);
      connect(rateGoodAct, SIGNAL(triggered()), this, SLOT(rateGood()));
      
      rateAverageAct = new QAction(QIcon(":/images/rate-3.png"), tr("Average"), this);
      rateAverageAct->setShortcut(Qt::CTRL + Qt::Key_3);
      connect(rateAverageAct, SIGNAL(triggered()), this, SLOT(rateAvarge()));
      
      rateBelowAvarageAct = new QAction(QIcon(":/images/rate-2.png"), tr("Below avarage"), this);
      rateBelowAvarageAct->setShortcut(Qt::CTRL + Qt::Key_2);
      connect(rateBelowAvarageAct, SIGNAL(triggered()), this, SLOT(rateBelowAverage()));      
      
      rateBadAct = new QAction(QIcon(":/images/rate-1.png"), tr("Bad"), this);
      rateBadAct->setShortcut(Qt::CTRL + Qt::Key_1);
      connect(rateBadAct, SIGNAL(triggered()), this, SLOT(rateBad()));
      
      rateUnratedAct = new QAction(tr("Unrated"), this);
      rateUnratedAct->setShortcut(Qt::CTRL + Qt::Key_0);
      connect(rateUnratedAct, SIGNAL(triggered()), this, SLOT(rateUnrated()));
      
      QMenu *ratingMenu = new QMenu(tr("Rating"), this);
      ratingMenu->setIcon(QIcon(":/images/rating.png"));
      ratingMenu->addAction(rateExcellenAct);
      ratingMenu->addAction(rateGoodAct);
      ratingMenu->addAction(rateAverageAct);
      ratingMenu->addAction(rateBelowAvarageAct);
      ratingMenu->addAction(rateBadAct);
      ratingMenu->addAction(rateUnratedAct);

      contextMnu.clear();
      contextMnu.addAction(openphotoAct);
      contextMnu.addSeparator();
      contextMnu.addMenu( ratingMenu);
      contextMnu.addSeparator();
      contextMnu.addAction(removephotoAct); 
      contextMnu.exec( mevent->globalPos() );
}
Example #8
0
void ConsoleChannel::initCapabilityMenu(const QLCChannel* ch)
{
    QLCCapability* cap;
    QMenu* valueMenu;
    QAction* action;
    QString s;
    QString t;

    QListIterator <QLCCapability*> it(ch->capabilities());
    while (it.hasNext() == true)
    {
        cap = it.next();

        // Set the value range and name as the menu item's name
        s = QString("%1: %2 - %3").arg(cap->name())
            .arg(cap->min()).arg(cap->max());

        if (cap->max() - cap->min() > 0)
        {
            // Create submenu for ranges of more than one value
            valueMenu = new QMenu(m_menu);
            valueMenu->setTitle(s);

            /* Add a color icon */
            if (ch->group() == QLCChannel::Colour)
                valueMenu->setIcon(colorIcon(cap->name()));

            for (int i = cap->min(); i <= cap->max(); i++)
            {
                action = valueMenu->addAction(
                             t.sprintf("%.3d", i));
                action->setData(i);
            }

            m_menu->addMenu(valueMenu);
        }
        else
        {
            // Just one value in this range, put that into the menu
            action = m_menu->addAction(s);
            action->setData(cap->min());

            /* Add a color icon */
            if (ch->group() == QLCChannel::Colour)
                action->setIcon(colorIcon(cap->name()));
        }
    }

    // Connect menu item activation signal to this
    connect(m_menu, SIGNAL(triggered(QAction*)),
            this, SLOT(slotContextMenuTriggered(QAction*)));

    // Set the menu also as the preset button's popup menu
    m_presetButton->setMenu(m_menu);
}
Example #9
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;
    }
Example #10
0
/*!
    \fn productos::crearMenu( QMenuBar *m )
 */
void productos::crearMenu( QMenuBar *m )
{
 QMenu *menuHer = m->findChild<QMenu *>( "menuHerramientas" );
 if( menuHer != 0 ) {
     QMenu *menuProductos = menuHer->addMenu( "Productos" );
     menuProductos->setIcon( ActProductos->icon() );
     menuProductos->setObjectName( "menuProductos" );
     menuProductos->addAction( ActProductos );
     if( preferencias::getInstancia()->value( "Preferencias/Productos/categorias" ).toBool() )
     { menuProductos->addAction( ActCategorias ); }
     menuProductos->addAction( ActRemarcar );
 }
}
Example #11
0
QMenu* Translator::createLanguagesMenu(QMap<QAction*, QString> &actionLanguage) {
        QMenu *languagesMenu = new QMenu(tr("GoogleTranslate"));
        languagesMenu->setIcon(QIcon(":/images/google.png"));
	actionLanguage[languagesMenu->addAction(tr("Restore original"))] = "-";
	languagesMenu->addSeparator();
        for (int i = 0; i < languageCodesSorted.size(); ++i) {
                QString languageCode = languageCodesSorted[i];
                QString country = "";
                if (countries.find(languageCode) != countries.end()) country = countries[languageCode];
                else country = languageCode.mid(0, 2);
                actionLanguage[languagesMenu->addAction(QIcon(":/images/countries/" + country + ".png"), languages[languageCode])] = languageCode;
	}
	return languagesMenu;
}
Example #12
0
void
FileView::contextMenuEvent( QContextMenuEvent *e )
{
    if( !model() )
        return;

    //trying to do fancy stuff while showing places only leads to tears!
    if( model()->objectName() == "PLACESMODEL" )
    {
        e->accept();
        return;
    }

    QModelIndexList indices = selectedIndexes();
    // Abort if nothing is selected
    if( indices.isEmpty() )
        return;

    KMenu menu;
    foreach( QAction *action, actionsForIndices( indices, PlaylistAction ) )
        menu.addAction( action );
    menu.addSeparator();

    // Create Copy/Move to menu items
    // ported from old filebrowser
    QList<Collections::Collection*> writableCollections;
    QHash<Collections::Collection*, CollectionManager::CollectionStatus> hash =
            CollectionManager::instance()->collections();
    QHash<Collections::Collection*, CollectionManager::CollectionStatus>::const_iterator it =
            hash.constBegin();
    while( it != hash.constEnd() )
    {
        Collections::Collection *coll = it.key();
        if( coll && coll->isWritable() )
            writableCollections.append( coll );
        ++it;
    }
    if( !writableCollections.isEmpty() )
    {
        QMenu *copyMenu = new QMenu( i18n( "Copy to Collection" ), &menu );
        copyMenu->setIcon( KIcon( "edit-copy" ) );
        foreach( Collections::Collection *coll, writableCollections )
        {
            CollectionAction *copyAction = new CollectionAction( coll, &menu );
            connect( copyAction, SIGNAL(triggered()), this, SLOT(slotPrepareCopyTracks()) );
            copyMenu->addAction( copyAction );
        }
bool ApplicationsMenuApplet::init(QWidget* parent)
{
  if(m_settings.type() == QVariant::List)
  {
    QVariantList list = m_settings.value<QVariantList>();

    while(!list.isEmpty())
    {
      const char** names = reinterpret_cast<const char**>(list.takeFirst().value<void*>());

      QMenu* menu = m_menu->addMenu(g_menu_names.value(names[0]));
      menu->setIcon(QIcon::fromTheme(names[1]).pixmap(menu->height(),menu->height()));
      m_menus.insert(g_menu_names.value(names[0]), menu);
    }

    QStringList categories;
    for(QList<DesktopEntryObject*>::iterator pos = m_entries.begin(); pos != m_entries.end(); ++pos)
    {
      if(m_menus.contains((*pos)->Category()))
        m_menus[(*pos)->Category()]->addAction((*pos)->Action());
      else
        m_menus["Other"]->addAction((*pos)->Action());
/*
      categories = (*pos)->Categories();
      for(QStringList::iterator pos2 = categories.begin(); pos2 != categories.end(); ++pos2)
        if(m_menus.contains(*pos2))
          m_menus[*pos2]->addAction((*pos)->Action());
*/
    }
  }

  m_menu->addSeparator();
  m_menu->addAction(QIcon::fromTheme("application-exit"), "Quit", qApp, SLOT(quit()));

/*
  connect(DesktopApplications::instance(), SIGNAL(applicationUpdated(const DesktopApplication&)), this, SLOT(onApplicationUpdated(const DesktopApplication&)));
  connect(DesktopApplications::instance(), SIGNAL(applicationRemoved(const QString&)), this, SLOT(onApplicationRemoved(const QString&)));

  QList<DesktopApplication> apps = DesktopApplications::instance()->applications();
  foreach(const DesktopApplication& app, apps)
    onApplicationUpdated(app);
*/

  return true;
}
Example #14
0
QMenu* EventCanvas::genItemPopup(CItem* item)/*{{{*/
{
    QMenu* notePopup = new QMenu(this);
    QMenu* colorPopup = notePopup->addMenu(tr("Part Color"));

    QMenu* colorSub;
    for (int i = 0; i < NUM_PARTCOLORS; ++i)
    {
        QString colorname(config.partColorNames[i]);
        if(colorname.contains("menu:", Qt::CaseSensitive))
        {
            colorSub = colorPopup->addMenu(colorname.replace("menu:", ""));
        }
        else
        {
            if(item->part()->colorIndex() == i)
            {
                colorname = QString(config.partColorNames[i]);
                colorPopup->setIcon(partColorIcons.at(i));
                colorPopup->setTitle(colorSub->title()+": "+colorname);

                colorname = QString("* "+config.partColorNames[i]);
                QAction *act_color = colorSub->addAction(partColorIcons.at(i), colorname);
                act_color->setData(20 + i);
            }
            else
            {
                colorname = QString("     "+config.partColorNames[i]);
                QAction *act_color = colorSub->addAction(partColorIcons.at(i), colorname);
                act_color->setData(20 + i);
            }
        }
    }

    notePopup->addSeparator();
    for (unsigned i = 0; i < 9; ++i)
    {
        if ((_canvasTools & (1 << i)) == 0)
            continue;
        QAction* act = notePopup->addAction(QIcon(*toolList[i].icon), tr(toolList[i].tip));
        act->setData(1 << i);
    }

    return notePopup;
}/*}}}*/
Example #15
0
bool EditorFrame::addTreeViewContextMenuAddActions(bool clearMenu)
{
  bool success = false;

  if(!mContextMenu){
    return success;
  }

  if(clearMenu){
    mContextMenu->clear();
  }

  mAllowableChildTypes.clear();
  mAllowableChildTypes = mModelExplorer->getAllowableChildTypes();
  QMenu * addSubMenu = nullptr;
  //bool connected = false;
  QString name;
  QString string;
  for(unsigned i=0 ; i<mAllowableChildTypes.size(); i++){
    if(addSubMenu == nullptr){
      addSubMenu = new QMenu(tr("Add"));
      addSubMenu->setIcon(QIcon(":/images/edit_add.png"));
      OS_ASSERT(addSubMenu);
      mContextMenu->addMenu(addSubMenu);
    }
    name = mAllowableChildTypes.at(i).valueName().c_str();
    string = mActionDescriptionPrefix + name;
    QAction * newAddAction = new QAction(QIcon(":/images/edit_add.png"), tr(string.toStdString().c_str()), this);
    ///! No connection required as the context menu will always call addObject()
    ///! Context menu signal has QAction->text() to pass to addObject()
    addSubMenu->addAction(newAddAction);
  }
  if(mAllowableChildTypes.size()){
    success = true;
  }

  if(!success){
    QAction * inactiveAddAction = new QAction(QIcon(":/images/edit_add_off.png"), tr("Nothing available to add to this object"), this);
    mContextMenu->addAction(inactiveAddAction);
    success = true;
  }

  return success;
}
Example #16
0
//===========
//  PRIVATE
//===========
void AppMenu::updateAppList(){
  this->clear();
  APPS.clear();
  APPS = LXDG::sortDesktopCats( LXDG::systemDesktopFiles() );
  //Now fill the menu
  bool ok; //for checking inputs
    //--Look for the app store
    XDGDesktop store = LXDG::loadDesktopFile(appstorelink, ok);
    if(ok){ 
      this->addAction( LXDG::findIcon(store.icon, ""), tr("Get Applications"), this, SLOT(launchStore()) );
      this->addSeparator(); 
    }
    //--Now create the sub-menus
    QStringList cats = APPS.keys();
    cats.sort(); //make sure they are alphabetical
    for(int i=0; i<cats.length(); i++){
      //Make sure they are translated and have the right icons
      QString name, icon;
      if(cats[i] == "Multimedia"){ name = tr("Multimedia"); icon = "applications-multimedia"; }
      else if(cats[i] == "Development"){ name = tr("Development"); icon = "applications-development"; }
      else if(cats[i] == "Education"){ name = tr("Education"); icon = "applications-education"; }
      else if(cats[i] == "Game"){ name = tr("Games"); icon = "applications-games"; }
      else if(cats[i] == "Graphics"){ name = tr("Graphics"); icon = "applications-graphics"; }
      else if(cats[i] == "Network"){ name = tr("Network"); icon = "applications-internet"; }
      else if(cats[i] == "Office"){ name = tr("Office"); icon = "applications-office"; }
      else if(cats[i] == "Science"){ name = tr("Science"); icon = "applications-science"; }
      else if(cats[i] == "Settings"){ name = tr("Settings"); icon = "preferences-system"; }
      else if(cats[i] == "System"){ name = tr("System"); icon = "applications-system"; }
      else if(cats[i] == "Utility"){ name = tr("Utility"); icon = "applications-utilities"; }
      else{ name = tr("Unsorted"); icon = "applications-other"; }
      
      QMenu *menu = new QMenu(name, this);
      menu->setIcon(LXDG::findIcon(icon,""));
      connect(menu, SIGNAL(triggered(QAction*)), this, SLOT(launchApp(QAction*)) );
      QList<XDGDesktop> appL = APPS.value(cats[i]);
      for( int a=0; a<appL.length(); a++){
        QAction *act = new QAction(LXDG::findIcon(appL[a].icon, ""), appL[a].name, this);
        act->setToolTip(appL[a].comment);
        act->setWhatsThis(appL[a].filePath);
        menu->addAction(act);
      }
      this->addMenu(menu);
    }
}
Example #17
0
void BreakpointWidget::setupPopupMenu()
{
    m_popup = new QMenu(this);

    QMenu* newBreakpoint = m_popup->addMenu( i18nc("New breakpoint", "&New") );
    newBreakpoint->setIcon(QIcon::fromTheme(QStringLiteral("list-add")));

    QAction* action = newBreakpoint->addAction(
        i18nc("Code breakpoint", "&Code"),
        this,
        SLOT(slotAddBlankBreakpoint()) );
    // Use this action also to provide a local shortcut
    action->setShortcut(QKeySequence(Qt::Key_B + Qt::CTRL,
                                        Qt::Key_C));
    addAction(action);

    newBreakpoint->addAction(
        i18nc("Data breakpoint", "Data &Write"),
        this, SLOT(slotAddBlankWatchpoint()));
    newBreakpoint->addAction(
        i18nc("Data read breakpoint", "Data &Read"),
        this, SLOT(slotAddBlankReadWatchpoint()));
    newBreakpoint->addAction(
        i18nc("Data access breakpoint", "Data &Access"),
        this, SLOT(slotAddBlankAccessWatchpoint()));

    QAction* breakpointDelete = m_popup->addAction(
        QIcon::fromTheme(QStringLiteral("edit-delete")),
        i18n( "&Delete" ),
        this,
        SLOT(slotRemoveBreakpoint()));
    breakpointDelete->setShortcut(Qt::Key_Delete);
    breakpointDelete->setShortcutContext(Qt::WidgetWithChildrenShortcut);
    addAction(breakpointDelete);


    m_popup->addSeparator();
    m_breakpointDisableAllAction = m_popup->addAction(i18n("Disable &All"), this, SLOT(slotDisableAllBreakpoints()));
    m_breakpointEnableAllAction = m_popup->addAction(i18n("&Enable All"), this, SLOT(slotEnableAllBreakpoints()));
    m_breakpointRemoveAll = m_popup->addAction(i18n("&Remove All"), this, SLOT(slotRemoveAllBreakpoints()));

    connect(m_popup,&QMenu::aboutToShow, this, &BreakpointWidget::slotPopupMenuAboutToShow);
}
Example #18
0
void LinksDialog::linkTreeWidgetCostumPopupMenu( QPoint point )
{

      QMenu contextMnu( this );

      QAction *voteupAct = new QAction(QIcon(IMAGE_EXPORTFRIEND), tr( "Share Link Anonymously" ), &contextMnu );
      connect( voteupAct , SIGNAL( triggered() ), this, SLOT( voteup_anon() ) );


      	QMenu *voteMenu = new QMenu( tr("Vote on Link"), &contextMnu );
      	voteMenu->setIcon(QIcon(IMAGE_EXPORTFRIEND));

        QAction *vote_p2 = new QAction( QIcon(IMAGE_GREAT), tr("+2 Great!"), &contextMnu );
        connect( vote_p2 , SIGNAL( triggered() ), this, SLOT( voteup_p2() ) );
	voteMenu->addAction(vote_p2);
		QAction *vote_p1 = new QAction( QIcon(IMAGE_GOOD), tr("+1 Good"), &contextMnu );
        connect( vote_p1 , SIGNAL( triggered() ), this, SLOT( voteup_p1() ) );
	voteMenu->addAction(vote_p1);
		QAction *vote_p0 = new QAction( QIcon(IMAGE_OK), tr("0 Okay"), &contextMnu );
        connect( vote_p0 , SIGNAL( triggered() ), this, SLOT( voteup_p0() ) );
	voteMenu->addAction(vote_p0);
		QAction *vote_m1 = new QAction( QIcon(IMAGE_SUX), tr("-1 Sux"), &contextMnu );
        connect( vote_m1 , SIGNAL( triggered() ), this, SLOT( voteup_m1() ) );
	voteMenu->addAction(vote_m1);
		QAction *vote_m2 = new QAction( QIcon(IMAGE_BADLINK), tr("-2 Bad Link"), &contextMnu );
        connect( vote_m2 , SIGNAL( triggered() ), this, SLOT( voteup_m2() ) );
	voteMenu->addAction(vote_m2);

	QAction *downloadAct = new QAction(QIcon(IMAGE_DOWNLOAD), tr("Download"), &contextMnu);
	connect(downloadAct, SIGNAL(triggered()), this, SLOT(downloadSelected()));

      contextMnu.addAction(voteupAct);
      contextMnu.addSeparator();
      contextMnu.addMenu(voteMenu);
      contextMnu.addSeparator();
      contextMnu.addAction(downloadAct);

      contextMnu.exec(ui.linkTreeWidget->viewport()->mapToGlobal(point));
}
Example #19
0
void TrayMenu::changeCompletedChunks(int)
{
	RTorrent * torrent = dynamic_cast<RTorrent *>(sender());
	if(!torrent) return;
	
	if(torrent->getSizeChunks() == torrent->getCompletedChunks())
	{
		QMenu * tmenu = torrents.take(torrent->getId());
		tray->showMessage(tr("Torrent complete"),tr("Torrent %1 downloaded").arg(torrent->getName()));
		QSettings settings;
		if(settings.value("delete_completed",false).toBool())
		{
			delete tmenu;
			delete torrent;
			if(torrents.isEmpty())
				no_torrent->setVisible(true);
		}else{
			tmenu->setIcon(QIcon(":/img/finish.png"));			
		}
		
	}
}
Example #20
0
void PIM_Handler::populateWebViewMenu(QMenu* menu, WebView* view, const WebHitTestResult &hitTest)
{
    m_view = view;
    m_clickedPos = hitTest.pos();

    if (!hitTest.isContentEditable()) {
        return;
    }

    if (!m_loaded) {
        loadSettings();
    }

    QMenu* pimMenu = new QMenu(tr("Insert Personal Information"));
    pimMenu->setIcon(QIcon(":/PIM/data/PIM.png"));

    if (!m_allInfo[PI_FirstName].isEmpty() && !m_allInfo[PI_LastName].isEmpty()) {
        const QString fullname = m_allInfo[PI_FirstName] + " " + m_allInfo[PI_LastName];
        QAction* action = pimMenu->addAction(fullname, this, SLOT(pimInsert()));
        action->setData(fullname);
    }

    for (int i = 0; i < PI_Max; ++i) {
        const QString info = m_allInfo[PI_Type(i)];
        if (info.isEmpty()) {
            continue;
        }

        QAction* action = pimMenu->addAction(info, this, SLOT(pimInsert()));
        action->setData(info);
        action->setStatusTip(m_translations[PI_Type(i)]);
    }

    pimMenu->addSeparator();
    pimMenu->addAction(tr("Edit"), this, SLOT(showSettings()));

    menu->addMenu(pimMenu);
    menu->addSeparator();
}
Example #21
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;
    }
Example #22
0
QMenu *BtMenuView::newMenu(QMenu *parentMenu, const QModelIndex &itemIndex) {
    QVariant displayData(m_model->data(itemIndex, Qt::DisplayRole));
    QVariant iconData(m_model->data(itemIndex, Qt::DecorationRole));
    QVariant toolTipData(m_model->data(itemIndex, Qt::ToolTipRole));
    QVariant statusTipData(m_model->data(itemIndex, Qt::StatusTipRole));
    QVariant whatsThisData(m_model->data(itemIndex, Qt::WhatsThisRole));

    QMenu *childMenu = new QMenu(parentMenu);

    // Set text:
    if (displayData.canConvert(QVariant::String)) {
        childMenu->setTitle(displayData.toString());
    }

    // Set icon:
    if (iconData.canConvert(QVariant::Icon)) {
        childMenu->setIcon(iconData.value<QIcon>());
    }

    // Set tooltip:
    if (toolTipData.canConvert(QVariant::String)) {
        childMenu->setToolTip(toolTipData.toString());
    }

    // Set status tip:
    if (statusTipData.canConvert(QVariant::String)) {
        childMenu->setStatusTip(statusTipData.toString());
    }

    // Set whatsthis:
    if (whatsThisData.canConvert(QVariant::String)) {
        childMenu->setWhatsThis(whatsThisData.toString());
    }

    return childMenu;
}
Example #23
0
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    QAction *qaAction;
    QMenu *menMain = new QMenu();

    QMenu *menPref = new QMenu();
    QMenu *menAcc = new QMenu();
    QMenu *menDevel = new QMenu();
    QMenu *menEdu = new QMenu();
    QMenu *menGraph = new QMenu();
    QMenu *menHam = new QMenu();
    QMenu *menInter = new QMenu();
    QMenu *menMulti = new QMenu();
    QMenu *menOffic = new QMenu();
    QMenu *menOth = new QMenu();
    QMenu *menSci = new QMenu();
    QMenu *menSys = new QMenu();

    QDesktopWidget *qDesktop = new QDesktopWidget();
    QRect qrDesktop = qDesktop->availableGeometry();
    QFile file(QDir::homePath() + "/.qtmenu");
    QString strProcess;
    QString strForeColor;
    QString strBackColor;
    int nLeft = -1;
    int nTop = -1;

    QDir qdDir = QDir(strSysApps);
    QFileInfoList qflList = qdDir.entryInfoList();

    QString strRunCommand = "fbrun -nearmouse";
    QString strExitCommand = "fluxbox-remote quit";
    QString strRebootCommand = "sudo reboot";
    QString strPoweroffCommand = "sudo poweroff";
    QStringList strlistCustoms;
    QString strTheme;

    bool blShowGNOME = true;
    bool blShowLXDE = true;
    bool blShowKDE = true;
    bool blShowMATE = true;
    bool blShowXFCE = true;


    QList<MenuListItem> mliList;
    MenuListItem mliListTemp;
    QMenu *menTemp;
    int nCount = qflList.count() - 1;
    bool blFirstLoop = true;
    bool blHasCustoms = false;

    bool blIconHasPath = false;
    bool blIconHasExt = false;

    // process config file
    if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
        while (!file.atEnd())
        {
            strProcess = file.readLine().trimmed();

            // left positioning
            if (strProcess.toLower().startsWith("left=")) {
                strProcess.remove(0, 5);
                nLeft = strProcess.toInt();
            } else
            // top positioning
            if (strProcess.toLower().startsWith("top=")) {
                strProcess.remove(0, 4);
                nTop = strProcess.toInt();
            } else
            // custom menu items
            if (strProcess.toLower().startsWith("custom=")) {
                strProcess.remove(0, 7);
                strlistCustoms.append(strProcess);
            } else
            // theme
            if (strProcess.toLower().startsWith("icontheme=")) {
                strProcess.remove(0, 10);
                strTheme = strProcess;
            } else
            // foreground
            if (strProcess.toLower().startsWith("fg=")) {
                strProcess.remove(0, 3);
                if (strProcess != "") {
                    strForeColor = strProcess;
                }
            } else
            // background
            if (strProcess.toLower().startsWith("bg=")) {
                strProcess.remove(0, 3);
                if (strProcess != "") {
                    strBackColor = strProcess;
                }
            } else
            // show gnome items?
            if (strProcess.toLower().startsWith("showgnomeitems=")) {
                strProcess.remove(0, 15);
                if (strProcess.contains("true") ) {
                    blShowGNOME = true;
                } else {
                    blShowGNOME = false;
                }
            } else
            // show lxde items?
            if (strProcess.toLower().startsWith("showlxdeitems=")) {
                strProcess.remove(0, 14);
                if (strProcess.contains("true") ) {
                    blShowLXDE = true;
                } else {
                    blShowLXDE = false;
                }
            } else
            // show kde items?
            if (strProcess.toLower().startsWith("showkdeitems=")) {
                strProcess.remove(0, 14);
                if (strProcess.contains("true") ) {
                    blShowKDE = true;
                } else {
                    blShowKDE = false;
                }
            } else
            // show mate items?
            if (strProcess.toLower().startsWith("showmateitems=")) {
                strProcess.remove(0, 14);
                if (strProcess.contains("true") ) {
                    blShowMATE = true;
                } else {
                    blShowMATE = false;
                }
            } else
            // show xfce items?
            if (strProcess.toLower().startsWith("showxfceitems=")) {
                strProcess.remove(0, 14);
                if (strProcess.contains("true") ) {
                    blShowXFCE = true;
                } else {
                    blShowXFCE = false;
                }
            } else
            // run command
            if (strProcess.toLower().startsWith("runcommand=")) {
                strProcess.remove(0, 11);
                if (strProcess != "") {
                    strRunCommand = strProcess;
                }
            } else
            // exit command
            if (strProcess.toLower().startsWith("exitcommand=")) {
                strProcess.remove(0, 12);
                if (strProcess != "") {
                    strExitCommand = strProcess;
                }
            } else
            // reboot command
            if (strProcess.toLower().startsWith("restartcommand=")) {
                strProcess.remove(0, 15);
                if (strProcess != "") {
                    strRebootCommand = strProcess;
                }
            } else
            // poweroff command
            if (strProcess.toLower().startsWith("poweroffcommand=")) {
                strProcess.remove(0, 16);
                if (strProcess != "") {
                    strPoweroffCommand = strProcess;
                }
            }
        }
    }

    // set icon theme
    if (strTheme != "") {
        QIcon::setThemeName(strTheme);
    } else {
        QIcon::setThemeName("hicolor");
    }

    // custom menu items from config file
    for (int n = 0; n < strlistCustoms.count(); n++)
    {
        MenuListItem mi;

        strProcess = strlistCustoms.at(n);
        mi.strName = strProcess.section("|", 0, 0);
        mi.strExec = strProcess.section("|", 1, 1);
        mi.strIcon = strProcess.section("|", 2, 2);
        mi.strCategory = "CustomItems";

        mliList.append(mi);

        blHasCustoms = true;
    }

    // read desktop files and insert menu items
    for (int n = 0; n < nCount;)
    {
        QFileInfo fileInfo = qflList.at(n);
        QFile qfFile(fileInfo.absoluteFilePath());
        MenuListItem mi;
        bool blNoShow = false;
        bool blOkToParse = false;

        if (qfFile.open(QIODevice::ReadOnly|QIODevice::Text)) {
            while (!qfFile.atEnd())
            {
                strProcess = qfFile.readLine();

                // set parse flag if we are in the Desktop Entry section
                if (strProcess.startsWith("[") && strProcess.contains("Desktop Entry")) {
                    blOkToParse = true;
                }
                if (blOkToParse) {
                    // app name
                    if (strProcess.startsWith("Name=")) {
                        strProcess.remove(0,5);
                        mi.strName = strProcess.trimmed().remove("_");
                    } else
                    // app icon
                    if (strProcess.startsWith("Icon=")) {
                        strProcess.remove(0,5);
                        mi.strIcon = strProcess.trimmed();
                    } else
                    // app exec line
                    if (strProcess.startsWith("Exec=")) {
                        strProcess.remove(0,5);
                        mi.strExec = strProcess.trimmed();
                        mi.strExec.remove("%F");
                        mi.strExec.remove("%f");
                        mi.strExec.remove("%U");
                        mi.strExec.remove("%u");
                    } else
                    // app category
                    if (strProcess.startsWith("Categories=")) {
                        if (blFirstLoop) {
                            strProcess.remove(0,11);
                            mi.strCategory = strProcess.trimmed();
                        } else {
                            mi.strCategory = "Other";
                        }
                    } else
                    // needs terminal?
                    if (strProcess.startsWith("Terminal=")) {
                        strProcess.remove(0,9);

                        if (strProcess.toLower().contains("true")) {
                            mi.blNeedsTerminal = true;
                        } else {
                            mi.blNeedsTerminal = false;
                        }
                    } else
                    // don't display?
                    if (strProcess.startsWith("NoDisplay=")) {
                        strProcess.remove(0,10);
                        if (strProcess.contains("True") ||
                           strProcess.contains("true")
                           ) {
                            blNoShow = true;
                        }
                    } else
                    // show gnome stuff?
                    if (strProcess.contains("OnlyShowIn=GNOME")) {
                        if (blShowGNOME == true) {
                            blNoShow = false;
                        } else {
                            blNoShow = true;
                        }
                    } else
                    // show lxde stuff?
                    if (strProcess.contains("OnlyShowIn=LXDE")) {
                        if (blShowLXDE == true) {
                            blNoShow = false;
                        } else {
                            blNoShow = true;
                        }
                    } else
                    // show kde stuff?
                    if (strProcess.contains("OnlyShowIn=KDE")) {
                        if (blShowKDE == true) {
                            blNoShow = false;
                        } else {
                            blNoShow = true;
                        }
                    } else
                    // show mate stuff?
                    if (strProcess.contains("OnlyShowIn=MATE")) {
                        if (blShowMATE == true) {
                            blNoShow = false;
                        } else {
                            blNoShow = true;
                        }
                    } else
                    // show xfce stuff?
                    if (strProcess.contains("OnlyShowIn=XFCE")) {
                        if (blShowXFCE == true) {
                            blNoShow = false;
                        } else {
                            blNoShow = true;
                        }
                    } else
                    // stop parsing if there are other sections
                    if (strProcess.startsWith("[") && !strProcess.contains("Desktop Entry")) {
                        break;
                    }
                }
            }

            if (mi.strName != "" && !blNoShow) {
                if (mi.blNeedsTerminal) {
                    mi.strExec = "x-terminal-emulator -e " + mi.strExec;
                }
                mliList.append(mi);
            }

        }

        if (qfFile.isOpen()) {
            qfFile.close();
        }

        // switch to local app folder and start over
        if (n == (nCount - 1) && blFirstLoop) {
            qdDir = QDir(QDir::homePath() + "/.local/share/applications");
            qflList = qdDir.entryInfoList();
            nCount = qflList.count() - 1;
            n = 0;
            blFirstLoop = false;
            QApplication::beep();
        } else {
            n++;
        }
    }


    // sort items alphabetically
    qSort(mliList);

    // set up category sub-menus
    menPref->setIcon(QIcon::fromTheme("preferences-desktop", QIcon::fromTheme("document-send")));
    menPref->setTitle("Preferences");
    menAcc->setIcon(QIcon::fromTheme("applications-accessories", QIcon::fromTheme("document-send")));
    menAcc->setTitle("Accessories");
    menDevel->setIcon(QIcon::fromTheme("applications-development", QIcon::fromTheme("document-send")));
    menDevel->setTitle("Development");
    menEdu->setIcon(QIcon::fromTheme("applications-science", QIcon::fromTheme("document-send")));
    menEdu->setTitle("Education");
    menGraph->setIcon(QIcon::fromTheme("applications-graphics", QIcon::fromTheme("document-send")));
    menGraph->setTitle("Graphics");
    menHam->setIcon(QIcon::fromTheme("applications-other", QIcon::fromTheme("document-send")));
    menHam->setTitle("Ham Radio");
    menInter->setIcon(QIcon::fromTheme("applications-internet", QIcon::fromTheme("document-send")));
    menInter->setTitle("Network");
    menMulti->setIcon(QIcon::fromTheme("applications-multimedia", QIcon::fromTheme("document-send")));
    menMulti->setTitle("Multimedia");
    menOffic->setIcon(QIcon::fromTheme("applications-office", QIcon::fromTheme("document-send")));
    menOffic->setTitle("Office");
    menOth->setIcon(QIcon::fromTheme("applications-other", QIcon::fromTheme("document-send")));
    menOth->setTitle("Other");
    menSci->setIcon(QIcon::fromTheme("applications-science", QIcon::fromTheme("document-send")));
    menSci->setTitle("Science");
    menSys->setIcon(QIcon::fromTheme("applications-system", QIcon::fromTheme("document-send")));
    menSys->setTitle("System");


    // *** collate by standard categories ***
    for (int i = mliList.size() - 1; i > -1; --i) {

        menTemp = menOth;

        mliListTemp = mliList.at(i);

        // custom items
        if (mliListTemp.strCategory.contains("CustomItems")) {
            menTemp = menMain;
        } else
        // settings / preferences
        if (mliListTemp.strCategory.contains("=Settings") ||
            mliListTemp.strCategory.contains(";Settings")
           ) {
            menTemp = menPref;
        } else
        // system
        if (mliListTemp.strCategory.contains("System")) {
            menTemp = menSys;
        } else
        // hamradio
        if (mliListTemp.strCategory.contains("HamRadio")) {
            menTemp = menHam;
        } else
        // science
        if (mliListTemp.strCategory.contains("Science")) {
            menTemp = menSci;
        } else
        // accessories / utility
        if (mliListTemp.strCategory.contains("Accessories") ||
            mliListTemp.strCategory.contains("Utility")
           ) {
            menTemp = menAcc;
        } else
        // development / programming
        if (mliListTemp.strCategory.contains("Development")) {
            menTemp = menDevel;
        } else
        // education / science
        if (mliListTemp.strCategory.contains("Education") ||
            mliListTemp.strCategory.contains("Science")
           ) {
            menTemp = menEdu;
        } else
        // graphics
        if (mliListTemp.strCategory.contains("Graphics")) {
            menTemp = menGraph;
        } else
        // internet / network
        if (mliListTemp.strCategory.contains("Internet") ||
                mliListTemp.strCategory.contains("WebBrowser") ||
                mliListTemp.strCategory.contains("Network")
                )
        {
            menTemp = menInter;
        } else

        // multimedia / sound/video
        if (mliListTemp.strCategory.contains("Audio") ||
                mliListTemp.strCategory.contains("AudioVideo") ||
                mliListTemp.strCategory.contains("Multimedia")
                )
        {
            menTemp = menMulti;
        } else
        // office / productivity
        if (mliListTemp.strCategory.contains("Office")  ||
                mliListTemp.strCategory.contains("Productivity")  ||
                mliListTemp.strCategory.contains("WordProcessor")
                )
        {
            menTemp = menOffic;
        }

        /* insert into menu */
        qaAction = new QAction(mliListTemp.strName, NULL);

        // figure out icon
        blIconHasExt = false;
        blIconHasPath = false;

        // has path
        if (mliListTemp.strIcon.contains("/")) {
            blIconHasPath = true;
        }

        // has extension
        if (mliListTemp.strIcon.contains(".png") ||
            mliListTemp.strIcon.contains(".xpm") ||
            mliListTemp.strIcon.contains(".svg")
            ) {
                blIconHasExt = true;
        }

        // no path and no extension
        if (blIconHasExt == false && blIconHasPath == false) {
            qaAction->setIcon(QIcon::fromTheme(mliListTemp.strIcon));
        } else
        // path
        if (blIconHasPath == true) {
            qaAction->setIcon(QIcon(mliListTemp.strIcon));
        } else
        // extension but no path
        if (blIconHasExt == true && blIconHasPath == false) {
            qaAction->setIcon(QIcon::fromTheme(mliListTemp.strIcon));
        }

        if (qaAction->icon().isNull()) {
            if (file.exists(strSysPix + "/" + mliListTemp.strIcon)) {
                qaAction->setIcon(QIcon(strSysPix + "/" + mliListTemp.strIcon));
            } else
            if (file.exists(strSysIco + "/" + mliListTemp.strIcon + ".png")) {
                qaAction->setIcon(QIcon(strSysIco + "/" + mliListTemp.strIcon + ".png"));
            } else
            if (file.exists(strSysIco + "/hicolor/scalable/apps/" + mliListTemp.strIcon + ".svg")) {
                qaAction->setIcon(QIcon(strSysIco + "/hicolor/scalable/apps/" + mliListTemp.strIcon + ".svg"));
            } else
            if (file.exists(strSysPix + "/" + mliListTemp.strIcon + ".png")) {
                qaAction->setIcon(QIcon(strSysPix + "/" + mliListTemp.strIcon + ".png"));
            } else
            if (file.exists(strSysPix + "/" + mliListTemp.strIcon + ".xpm")) {
                qaAction->setIcon(QIcon(strSysPix + "/" + mliListTemp.strIcon + ".xpm"));
            } else
            if (file.exists(strSysPix + "/" + mliListTemp.strIcon + ".svg")) {
                qaAction->setIcon(QIcon(strSysPix + "/" + mliListTemp.strIcon + ".svg"));
            }
        }

        qaAction->setIconVisibleInMenu(true);
        qaAction->setData(mliListTemp.strExec);

        menTemp->addAction(qaAction);
    }


    // add separator if there are customs
    if (blHasCustoms) {
        menMain->addSeparator();
    }

    // preferences
    if (menPref->actions().count() > 0) {
        menMain->addMenu(menPref);
        menMain->addSeparator();
    }

    // accessories
    if (menAcc->actions().count() > 0) {
        menMain->addMenu(menAcc);
    }

    // development
    if (menDevel->actions().count() > 0) {
        menMain->addMenu(menDevel);
    }

    // education
    if (menEdu->actions().count() > 0) {
        menMain->addMenu(menEdu);
    }

    // graphics
    if (menGraph->actions().count() > 0) {
        menMain->addMenu(menGraph);
    }

    // ham radio
    if (menHam->actions().count() > 0) {
        menMain->addMenu(menHam);
    }

    // internet/networking
    if (menInter->actions().count() > 0) {
        menMain->addMenu(menInter);
    }

    // multimedia / sound/video
    if (menMulti->actions().count() > 0) {
        menMain->addMenu(menMulti);
    }

    // office
    if (menOffic->actions().count() > 0) {
        menMain->addMenu(menOffic);
    }

    // other
    if (menOth->actions().count() > 0) {
        menMain->addMenu(menOth);
    }

    // science
    if (menSci->actions().count() > 0) {
        menMain->addMenu(menSci);
    }

    // system
    if (menSys->actions().count() > 0) {
        menMain->addMenu(menSys);
    }

    menMain->addSeparator();

    qaAction = new QAction("About...", NULL);
    qaAction->setData("...about...");
    qaAction->setIcon(QIcon::fromTheme("dialog-information"));
    menMain->addAction(qaAction);

    menMain->addSeparator();

    qaAction = new QAction("Run...", NULL);
    qaAction->setData(strRunCommand);
    menMain->addAction(qaAction);

    menMain->addSeparator();

    qaAction = new QAction("Exit", NULL);
    qaAction->setData(strExitCommand);
    qaAction->setIcon(QIcon::fromTheme("system-log-out"));
    menMain->addAction(qaAction);

    qaAction = new QAction("Reboot", NULL);
    qaAction->setData(strRebootCommand);
    qaAction->setIcon(QIcon::fromTheme("view-refresh"));
    menMain->addAction(qaAction);

    qaAction = new QAction("Shutdown", NULL);
    qaAction->setData(strPoweroffCommand);
    qaAction->setIcon(QIcon::fromTheme("system-shutdown"));
    menMain->addAction(qaAction);

    // set correct positioning
    if (nLeft == -1) {
        nLeft = qrDesktop.left();
    }

    if (nTop == -1) {
        nTop = qrDesktop.bottom();
    }

    // show menu
    qaAction = menMain->exec(QPoint(nLeft, nTop));

    // perform/run selected action
    if (qaAction != 0) {
        QString qsExec = qaAction->data().toString();
        if (qsExec == "...about...") {
            QMessageBox::about(NULL,
                               "About Qt Menu - Standalone",
                                "<h3>Qt Menu - Standalone</h3><br><br>"
                                "Copyright 2014 - Will Brokenbourgh<br>"
                                "Blog: http://www.pismotek.com/brainout/<br><br>"
                                "Version 0.1.1");
        } else {
            QProcess *qp = new QProcess();
            qp->setWorkingDirectory(QDir::homePath());
            qp->start(qsExec);
        }
    }
}
void CBookshelfIndex::initActions()
{

	// Each action has a type attached to it as a dynamic property, see actionenum.h.
	// Menuitem and its subitems can have the same type.
	// Actions can have also "singleItemAction" property if
	// it supports only one item.
	// See contextMenu() and BTIndexItem for how these properties are used later.

	// Actions are added to the popup menu and also to a list for easy foreach access.

	QMenu* actionMenu = 0;
	QAction* action = 0;

	// -------------------------Grouping --------------------------------------
	actionMenu = new QMenu(tr("Grouping"), this);
	actionMenu->setIcon(util::filesystem::DirectoryUtil::getIcon(CResMgr::mainIndex::grouping::icon));
	actionMenu->setProperty("indexActionType", QVariant(Grouping));

	m_groupingGroup = new QActionGroup(this);
	QObject::connect(m_groupingGroup, SIGNAL(triggered(QAction*)), this, SLOT(actionChangeGrouping(QAction*)) );

	//TODO: set the inital checked state
	action = newQAction(tr("Category/Language"), CResMgr::mainIndex::grouping::icon, 0, 0, 0, this);
	action->setCheckable(true);
	action->setProperty("indexActionType", QVariant(Grouping));
	action->setProperty("grouping", BTModuleTreeItem::CatLangMod);
	actionMenu->addAction(action);
	m_groupingGroup->addAction(action);
	if (m_grouping == BTModuleTreeItem::CatLangMod) action->setChecked(true);
	m_actionList.append(action);

	action = newQAction(tr("Category"),CResMgr::mainIndex::grouping::icon, 0, 0, 0, this);
	action->setCheckable(true);
	m_groupingGroup->addAction(action);
	if (m_grouping == BTModuleTreeItem::CatMod) action->setChecked(true);
	action->setProperty("indexActionType", QVariant(Grouping));
	action->setProperty("grouping", BTModuleTreeItem::CatMod);
	actionMenu->addAction(action);
	m_actionList.append(action);

	action = newQAction(tr("Language/Category"),CResMgr::mainIndex::grouping::icon, 0, 0, 0, this);
	action->setCheckable(true);
	m_groupingGroup->addAction(action);
	if (m_grouping == BTModuleTreeItem::LangCatMod) action->setChecked(true);
	actionMenu->addAction(action);
	action->setProperty("indexActionType", QVariant(Grouping));
	action->setProperty("grouping", BTModuleTreeItem::LangCatMod);
	m_actionList.append(action);

	action = newQAction(tr("Language"),CResMgr::mainIndex::grouping::icon, 0, 0, 0, this);
	action->setCheckable(true);
	m_groupingGroup->addAction(action);
	if (m_grouping == BTModuleTreeItem::LangMod) action->setChecked(true);
	actionMenu->addAction(action);
	action->setProperty("indexActionType", QVariant(Grouping));
	action->setProperty("grouping", BTModuleTreeItem::LangMod);
	m_actionList.append(action);

	action = newQAction(tr("Works only"),CResMgr::mainIndex::grouping::icon, 0, 0, 0, this);
	action->setCheckable(true);
	m_groupingGroup->addAction(action);
	if (m_grouping == BTModuleTreeItem::Mod) action->setChecked(true);
	actionMenu->addAction(action);
	action->setProperty("indexActionType", QVariant(Grouping));
	action->setProperty("grouping", BTModuleTreeItem::Mod);
	m_actionList.append(action);
	
	action = m_popup->addMenu(actionMenu);
	action->setProperty("indexActionType", QVariant(Grouping));
	m_actionList.append(action);


	// ------------Hide---------------------
	action = newQAction(tr("Hide/unhide works..."),CResMgr::mainIndex::search::icon, 0, this, SLOT(actionHideModules()), this);
	action->setProperty("indexActionType", QVariant(HideModules));
	//action->setProperty("multiItemAction", QVariant(true));
	m_popup->addAction(action);
	m_actionList.append(action);

// -------------------Show hidden---------------------------
	action = newQAction(tr("Show hidden"),CResMgr::mainIndex::search::icon, 0, 0, 0, this);
	action->setProperty("indexActionType", QVariant(ShowAllModules));
	action->setCheckable(true);
	QObject::connect(action, SIGNAL(toggled(bool)), this, SLOT(actionShowModules(bool)));
	if (m_showHidden) action->setChecked(true); else action->setChecked(false);
	m_popup->addAction(action);
	m_actionList.append(action);


	m_popup->addSeparator();

	//------------------------------------------------------------
	//----------------- Actions for items ------------------------

	// -------------------------Edit module --------------------------------
	actionMenu = new QMenu(tr("Edit"), this);
	actionMenu->setIcon(util::filesystem::DirectoryUtil::getIcon(CResMgr::mainIndex::editModuleMenu::icon) );
//	actionMenu->setDelayed(false);
	actionMenu->setProperty("indexActionType", QVariant(EditModule));
	actionMenu->setProperty("singleItemAction", QVariant(true));
	//m_actionList.append(actionMenu);

	action = newQAction(tr("Plain text..."),CResMgr::mainIndex::editModulePlain::icon, 0, this, SLOT(actionEditModulePlain()), this);
	actionMenu->addAction(action);
	m_actionList.append(action);
	action->setProperty("indexActionType", QVariant(EditModule));
	action->setProperty("singleItemAction", QVariant(true));

	action = newQAction(tr("HTML..."),CResMgr::mainIndex::editModuleHTML::icon, 0, this, SLOT(actionEditModuleHTML()), this);
	actionMenu->addAction(action);
	m_actionList.append(action);
	action->setProperty("indexActionType", QVariant(EditModule));
	action->setProperty("singleItemAction", QVariant(true));

	m_actionList.append(m_popup->addMenu(actionMenu));

	
	// ------------------------ Misc actions -------------------------------------
	action = newQAction(tr("Search..."),CResMgr::mainIndex::search::icon, 0, this, SLOT(actionSearchInModules()), this);
	action->setProperty("indexActionType", QVariant(SearchModules));
	action->setProperty("multiItemAction", QVariant(true));
	m_popup->addAction(action);
	m_actionList.append(action);

	action = newQAction(tr("Unlock..."),CResMgr::mainIndex::unlockModule::icon, 0, this, SLOT(actionUnlockModule()), this);
	m_popup->addAction(action);
	action->setProperty("indexActionType", QVariant(UnlockModule));
	action->setProperty("singleItemAction", QVariant(true));
	m_actionList.append(action);

	action = newQAction(tr("About..."),CResMgr::mainIndex::aboutModule::icon, 0, this, SLOT(actionAboutModule()), this);
	m_popup->addAction(action);
	action->setProperty("singleItemAction", QVariant(true));
	action->setProperty("indexActionType", QVariant(AboutModule));
	m_actionList.append(action);

	
}
Example #25
0
void MainWindow::createMenus()
{
	QMenu *fileMenu = menuBar()->addMenu(tr("&File"));
	fileMenu->addAction(m_newAction);
	fileMenu->addAction(m_openAction);
	fileMenu->addAction(m_openRecentAction);
	fileMenu->addSeparator();
	fileMenu->addAction(m_saveAction);
	fileMenu->addAction(m_saveAsAction);
	fileMenu->addAction(m_tikzPreviewController->exportAction());
	fileMenu->addSeparator();
	fileMenu->addAction(m_reloadAction);
	fileMenu->addSeparator();
	fileMenu->addAction(m_tikzPreviewController->printPreviewAction());
	fileMenu->addAction(m_tikzPreviewController->printAction());
	fileMenu->addSeparator();
	fileMenu->addAction(m_closeAction);
	fileMenu->addSeparator();
	fileMenu->addAction(m_exitAction);

	menuBar()->addMenu(m_tikzEditorView->editMenu());
	menuBar()->addMenu(m_tikzEditorView->bookmarksMenu());

	QMenu *viewMenu = m_tikzPreviewController->menu();
	viewMenu->insertAction(viewMenu->actions().at(viewMenu->actions().size() - 2), m_buildAction);
	viewMenu->addAction(m_viewLogAction);
	menuBar()->addMenu(viewMenu);

	m_settingsMenu = menuBar()->addMenu(tr("&Settings"));
	QMenu *toolBarMenu = new QMenu(tr("&Toolbars"), this);
	toolBarMenu->setIcon(Icon(QLatin1String("configure-toolbars")));
	toolBarMenu->menuAction()->setStatusTip(tr("Show or hide toolbars"));
	toolBarMenu->addAction(m_fileToolBar->toggleViewAction());
	toolBarMenu->addAction(m_editToolBar->toggleViewAction());
	toolBarMenu->addAction(m_viewToolBar->toggleViewAction());
	toolBarMenu->addAction(m_runToolBar->toggleViewAction());
	m_fileToolBar->toggleViewAction()->setStatusTip(tr("Show toolbar \"%1\"").arg(m_fileToolBar->windowTitle()));
	m_editToolBar->toggleViewAction()->setStatusTip(tr("Show toolbar \"%1\"").arg(m_editToolBar->windowTitle()));
	m_viewToolBar->toggleViewAction()->setStatusTip(tr("Show toolbar \"%1\"").arg(m_viewToolBar->windowTitle()));
	m_runToolBar->toggleViewAction()->setStatusTip(tr("Show toolbar \"%1\"").arg(m_runToolBar->windowTitle()));
	m_settingsMenu->addMenu(toolBarMenu);
	m_sideBarMenu = new QMenu(tr("&Sidebars"), this);
	m_sideBarMenu->setIcon(Icon(QLatin1String("configure-toolbars")));
	m_sideBarMenu->menuAction()->setStatusTip(tr("Show or hide sidebars"));
	m_sideBarMenu->addAction(m_previewDock->toggleViewAction());
	m_sideBarMenu->addAction(m_logDock->toggleViewAction());
	m_previewDock->toggleViewAction()->setStatusTip(tr("Show sidebar \"%1\"").arg(m_previewDock->windowTitle()));
	m_logDock->toggleViewAction()->setStatusTip(tr("Show sidebar \"%1\"").arg(m_logDock->windowTitle()));
	m_settingsMenu->addMenu(m_sideBarMenu);
	m_settingsMenu->addSeparator();
	m_settingsMenu->addAction(m_configureAction);
	connect(m_fileToolBar->toggleViewAction(), SIGNAL(toggled(bool)), this, SLOT(setToolBarStatusTip(bool)));
	connect(m_editToolBar->toggleViewAction(), SIGNAL(toggled(bool)), this, SLOT(setToolBarStatusTip(bool)));
	connect(m_viewToolBar->toggleViewAction(), SIGNAL(toggled(bool)), this, SLOT(setToolBarStatusTip(bool)));
	connect(m_runToolBar->toggleViewAction(), SIGNAL(toggled(bool)), this, SLOT(setToolBarStatusTip(bool)));
	connect(m_previewDock->toggleViewAction(), SIGNAL(toggled(bool)), this, SLOT(setDockWidgetStatusTip(bool)));
	connect(m_logDock->toggleViewAction(), SIGNAL(toggled(bool)), this, SLOT(setDockWidgetStatusTip(bool)));

	menuBar()->addSeparator();

	QMenu *helpMenu = menuBar()->addMenu(tr("&Help"));
	helpMenu->addAction(m_helpAction);
	helpMenu->addAction(m_showTikzDocAction);
	helpMenu->addAction(m_whatsThisAction);
	helpMenu->addSeparator();
	helpMenu->addAction(m_aboutAction);
	helpMenu->addAction(m_aboutQtAction);
}
Example #26
0
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
{
    /*--------------
     * Central area
     *--------------*/

    centralArea = new CentralArea(this);
    setCentralWidget(centralArea);

    /*--------------
     * Menu
     *--------------*/

    //---> Main menu
    QMenu *menuFile = menuBar()->addMenu("&File");
    QMenu *menuAlgorithm = menuBar()->addMenu("&Algorithm");
    QMenu *menuHelp = menuBar()->addMenu("&Help");

    //---> Sub menu file
    QAction *actionOpen = new QAction("&Open",this);
    menuFile->addAction(actionOpen);
    actionOpen->setIcon(QIcon("../../icons/glyphicons_144_folder_open.png"));

    QAction *actionOpenGPS = new QAction("Open &GPS",this);
    menuFile->addAction(actionOpenGPS);
    actionOpenGPS->setIcon(QIcon("../../icons/glyphicons_144_folder_open.png"));

    QMenu *menuSave = new QMenu("&Save",this);
    menuFile->addMenu(menuSave);
    menuSave->setIcon(QIcon("../../icons/glyphicons_443_floppy_disk.png"));
    QAction *actionSaveImage = new QAction("Save &Image",this);
    QAction *actionSaveMovie = new QAction("Save &Movie",this);
    menuSave->addAction(actionSaveImage);
    menuSave->addAction(actionSaveMovie);

    menuFile->addSeparator();

    QAction *actionExtract = new QAction("&Extract",this);
    menuFile->addAction(actionExtract);
    actionExtract->setIcon(QIcon("../../icons/glyphicons_041_charts.png"));
    mExtractDialog = new ExtractDialog(this);

    menuFile->addSeparator();

    QAction *actionClose = new QAction("&Close", this);
    menuFile->addAction(actionClose);
    actionClose->setIcon(QIcon("../../icons/glyphicons_063_power.png"));

    //---> Sub menu algorithm
    QAction *actionRANSAC = new QAction("&RANSAC",this);
    menuAlgorithm->addAction(actionRANSAC);
    actionRANSAC->setCheckable(true);

    QAction *actionTip = new QAction("&TIP",this);
    menuAlgorithm->addAction(actionTip);
    actionTip->setCheckable(true);
    actionTip->setEnabled(false);

    QAction *actionKalman = new QAction("&KALMAN",this);
    menuAlgorithm->addAction(actionKalman);
    actionKalman->setCheckable(true);
    actionKalman->setEnabled(false);

    //---> Sub menu help
    QAction *actionAbout = new QAction("&About",this);
    menuHelp->addAction(actionAbout);
    actionAbout->setIcon(QIcon("../../icons/glyphicons_082_roundabout.png"));

    //---> Slot connections

    // Quit
    connect(actionClose, SIGNAL(triggered()),qApp, SLOT(quit()));

    // Open
    connect(actionOpen,SIGNAL(triggered()),this,SLOT(openFileDialogue()));

    // Open GPS
    connect(actionOpenGPS,SIGNAL(triggered()),this,SLOT(openGPSDialogue()));

    // Save
    connect(actionSaveImage,SIGNAL(triggered()),this,SLOT(saveImageDialogue()));
    connect(actionSaveMovie,SIGNAL(triggered()),this,SLOT(saveMovieDialogue()));

    // Extract
    connect(actionExtract,SIGNAL(triggered()),this,SLOT(openExtractDialogue()));

    // About
    connect(actionAbout, SIGNAL(triggered()), this, SLOT(openAboutDialogue()));

    // RANSAC
    connect(actionRANSAC,SIGNAL(toggled(bool)),centralArea->getAlgorithmArea()->getGroupBoxRansac(),SLOT(setChecked(bool)));
    connect(centralArea->getAlgorithmArea()->getGroupBoxRansac(),SIGNAL(toggled(bool)),actionRANSAC,SLOT(setChecked(bool)));
    connect(actionRANSAC,SIGNAL(toggled(bool)),actionTip,SLOT(setEnabled(bool)));

    // TIP
    connect(actionTip,SIGNAL(toggled(bool)),centralArea->getAlgorithmArea()->getGroupBoxTip(),SLOT(setChecked(bool)));
    connect(centralArea->getAlgorithmArea()->getGroupBoxTip(),SIGNAL(toggled(bool)),actionTip,SLOT(setChecked(bool)));

    // KALMAN
    connect(actionKalman,SIGNAL(toggled(bool)),centralArea->getAlgorithmArea()->getGroupBoxKalman(),SLOT(setChecked(bool)));
    connect(centralArea->getAlgorithmArea()->getGroupBoxKalman(),SIGNAL(toggled(bool)),actionKalman,SLOT(setChecked(bool)));
    connect(actionTip,SIGNAL(toggled(bool)),actionKalman,SLOT(setEnabled(bool)));
}
Example #27
0
 void setIcon(const QIcon& icon)
 {
   if (menu)
     menu->setIcon(icon);
 }
Example #28
0
void QMenuProto::setIcon(const QIcon &icon)
{
  QMenu *item = qscriptvalue_cast<QMenu*>(thisObject());
  if (item)
    item->setIcon(icon);
}
Example #29
0
void KrBookmarkHandler::buildMenu(KrBookmark *parent, QMenu *menu)
{
    static int inSecondaryMenu = 0; // used to know if we're on the top menu

    // run the loop twice, in order to put the folders on top. stupid but easy :-)
    // note: this code drops the separators put there by the user
    QListIterator<KrBookmark *> it(parent->children());
    while (it.hasNext()) {
        KrBookmark *bm = it.next();

        if (!bm->isFolder()) continue;
        QMenu *newMenu = new QMenu(menu);
        newMenu->setIcon(QIcon(krLoader->loadIcon(bm->iconName(), KIconLoader::Small)));
        newMenu->setTitle(bm->text());
        QAction *menuAction = menu->addMenu(newMenu);
        QVariant v;
        v.setValue<KrBookmark *>(bm);
        menuAction->setData(v);

        ++inSecondaryMenu;
        buildMenu(bm, newMenu);
        --inSecondaryMenu;
    }

    it.toFront();
    while (it.hasNext()) {
        KrBookmark *bm = it.next();
        if (bm->isFolder()) continue;
        if (bm->isSeparator()) {
            menu->addSeparator();
            continue;
        }
        menu->addAction(bm);
        CONNECT_BM(bm);
    }

    if (!inSecondaryMenu) {
        KConfigGroup group(krConfig, "Private");
        bool hasPopularURLs = group.readEntry("BM Popular URLs", true);
        bool hasTrash       = group.readEntry("BM Trash",        true);
        bool hasLan         = group.readEntry("BM Lan",          true);
        bool hasVirtualFS   = group.readEntry("BM Virtual FS",   true);
        bool hasJumpback    = group.readEntry("BM Jumpback",     true);

        if (hasPopularURLs) {
            menu->addSeparator();

            // add the popular links submenu
            QMenu *newMenu = new QMenu(menu);
            newMenu->setTitle(i18n("Popular URLs"));
            newMenu->setIcon(QIcon(krLoader->loadIcon("folder-bookmark", KIconLoader::Small)));
            QAction *bmfAct  = menu->addMenu(newMenu);
            _specialBookmarks.append(bmfAct);
            // add the top 15 urls
#define MAX 15
            QList<QUrl> list = _mainWindow->popularUrls()->getMostPopularUrls(MAX);
            QList<QUrl>::Iterator it;
            for (it = list.begin(); it != list.end(); ++it) {
                QString name;
                if ((*it).isLocalFile()) name = (*it).path();
                else name = (*it).toDisplayString();
                // note: these bookmark are put into the private collection
                // as to not spam the general collection
                KrBookmark *bm = KrBookmark::getExistingBookmark(name, _privateCollection);
                if (!bm)
                    bm = new KrBookmark(name, *it, _privateCollection);
                newMenu->addAction(bm);
                CONNECT_BM(bm);
            }

            newMenu->addSeparator();
            newMenu->addAction(krPopularUrls);
            newMenu->installEventFilter(this);
        }

        // do we need to add special bookmarks?
        if (SPECIAL_BOOKMARKS) {
            if (hasTrash || hasLan || hasVirtualFS || hasJumpback)
                menu->addSeparator();

            KrBookmark *bm;

            // note: special bookmarks are not kept inside the _bookmarks list and added ad-hoc
            if (hasTrash) {
                bm = KrBookmark::trash(_collection);
                menu->addAction(bm);
                _specialBookmarks.append(bm);
                CONNECT_BM(bm);
            }

            if (hasLan) {
                bm = KrBookmark::lan(_collection);
                menu->addAction(bm);
                _specialBookmarks.append(bm);
                CONNECT_BM(bm);
            }

            if (hasVirtualFS) {
                bm = KrBookmark::virt(_collection);
                menu->addAction(bm);
                _specialBookmarks.append(bm);
                CONNECT_BM(bm);
            }

            if (hasJumpback) {
                // add the jump-back button
                ListPanelActions *actions = _mainWindow->listPanelActions();
                menu->addAction(actions->actJumpBack);
                _specialBookmarks.append(actions->actJumpBack);
                menu->addSeparator();
                menu->addAction(actions->actSetJumpBack);
                _specialBookmarks.append(actions->actSetJumpBack);
            }
        }

        if (!hasJumpback)
            menu->addSeparator();

        menu->addAction(KrActions::actAddBookmark);
        _specialBookmarks.append(KrActions::actAddBookmark);
        QAction *bmAct = menu->addAction(krLoader->loadIcon("bookmarks", KIconLoader::Small),
                                         i18n("Manage Bookmarks"), manager, SLOT(slotEditBookmarks()));
        _specialBookmarks.append(bmAct);

        // make sure the menu is connected to us
        disconnect(menu, SIGNAL(triggered(QAction *)), 0, 0);
    }
Example #30
0
Fenetre::Fenetre(QWidget *parent) : courant(0), QMainWindow(parent)
{
    //*************************
    courant = NULL;
    folder = NULL;
    resize(1200, 512);
    //*************************** Menu ***************************
    QMenu* mFile = menuBar()->addMenu("&File");
    QMenu* mEdit = menuBar()->addMenu("&Edit");
    QMenu* mView = menuBar()->addMenu("&View");


    QMenu* mNouveau = mFile->addMenu("New");
    QAction* mactionAnnuler = mEdit->addAction("Annuler");
    QAction* mactionRefaire = mEdit->addAction("Refaire");
    QAction* mactionSupprimer = mEdit->addAction("Supprimer");
    QMenu* mTag = mEdit->addMenu("Tags");
    QAction* mactionSupprimerTag = mTag->addAction("Supprimer");
    QMenu* mDocument = mEdit->addMenu("Documents");
    QAction* mactionUp = mDocument->addAction("Monter");
    QAction* mactionDown = mDocument->addAction("Descendre");
    QMenu* mExport = mEdit->addMenu("Exporter");
    QAction* mactionOuvrir = mFile->addAction("Ouvrir un espace de travail");
    QAction* mactionNew = mFile->addAction("Nouvel espace de travail");
    QAction* mactionSaveAs = mFile->addAction("Enregistrer sous...");
    QAction* mactionNewArticle = mNouveau->addAction("Article");
    QAction* mactionNewImage = mNouveau->addAction("Image");
    QAction* mactionNewAudio = mNouveau->addAction("Audio");
    QAction* mactionNewVideo = mNouveau->addAction("Video");
    QAction* mactionNewDocument = mNouveau->addAction("Document");

    QAction* mactionExportHTML = mExport->addAction("Html");
    QAction* mactionExportTex = mExport->addAction("Tex");
    QAction* mactionExportTexte = mExport->addAction("Texte");
    QAction* mactionOption=mEdit->addAction("Setting");

    QAction* mactionAddTag = mNouveau->addAction("Tag");

    QAction* mactionSave = mFile->addAction("Sauvegarder");
    mFile->addSeparator();
    QMenu* ouvrirCorbeille = mFile->addMenu("Corbeille");
    QAction* mactionRestaurer = ouvrirCorbeille->addAction("Restaurer");
    QAction* mactionVider = ouvrirCorbeille->addAction("Vider la Corbeille");

    mactionViewEdit = mView->addAction("Onglet Editeur");
    mactionViewHTML = mView->addAction("Onglet Html");
    mactionViewTex = mView->addAction("Onglet Tex");
    mactionViewTexte = mView->addAction("Onglet Texte");

    mFile->addSeparator();
    QAction* actionQuitter = mFile->addAction("&Quitter");
    actionQuitter->setIcon(QIcon("icon/quitter.png"));
    mactionNewArticle->setIcon(QIcon("icon/article.png"));
    mactionNewImage->setIcon(QIcon("icon/image.png"));
    mactionNewAudio->setIcon(QIcon("icon/audio.png"));
    mactionNewVideo->setIcon(QIcon("icon/video.png"));
    mNouveau->setIcon(QIcon("icon/plus.png"));
    mactionDown->setIcon(QIcon("icon/down.png"));
    mactionUp->setIcon(QIcon("icon/up.png"));
    mactionAddTag->setIcon(QIcon("icon/tag.png"));
    mactionSave->setIcon(QIcon("icon/save.png"));

    mactionExportHTML->setIcon(QIcon("icon/html.png"));
    mactionExportTex->setIcon(QIcon("icon/tex.png"));
    mactionExportTexte->setIcon(QIcon("icon/texte.png"));

    mactionAnnuler->setIcon(QIcon("icon/undo.png"));
    mactionRefaire->setIcon(QIcon("icon/redo.png"));
    mactionSupprimer->setIcon(QIcon("icon/cross.png"));
    mactionRestaurer->setIcon(QIcon("icon/corbeille.png"));
    mactionNewDocument->setIcon(QIcon("icon/document.png"));
    mactionOption->setIcon(QIcon("icon/setting.png"));


    mactionOuvrir->setShortcut(QKeySequence("Ctrl+O"));
    actionQuitter->setShortcut(QKeySequence("Ctrl+Q"));
    mactionSave->setShortcut(QKeySequence("Ctrl+S"));

    mactionAnnuler->setShortcut(QKeySequence("Ctrl+Z"));
    mactionRefaire->setShortcut(QKeySequence("Ctrl+Y"));
    mactionSupprimer->setShortcut(tr("Delete"));

    //** VIEW **//
    mactionViewEdit->setCheckable(true);
    mactionViewEdit->setChecked(true);
    mactionViewHTML->setCheckable(true);
    mactionViewTex->setCheckable(true);
    mactionViewTexte->setCheckable(true);


    //Bar de statue
    QStatusBar* statusBar = new QStatusBar;
    statusBar->addWidget(new QLabel("Projet Lo21 - Pauline Crouillère / Emilien Notarianni"));
    this->setStatusBar(statusBar);
    // Création de la barre d'outils
    QToolBar *toolBarFichier = addToolBar("Fichier");

    toolBarFichier->addAction(mactionNewArticle);
    toolBarFichier->addAction(mactionNewImage);
    toolBarFichier->addAction(mactionNewAudio);
    toolBarFichier->addAction(mactionNewVideo);
    toolBarFichier->addAction(mactionNewDocument);
    toolBarFichier->addSeparator();
    toolBarFichier->addAction(mactionAddTag);
    toolBarFichier->addSeparator();
    toolBarFichier->addAction(mactionUp);
    toolBarFichier->addAction(mactionDown);
    toolBarFichier->addSeparator();

    toolBarFichier->addAction(mactionExportHTML);
    toolBarFichier->addAction(mactionExportTex);
    toolBarFichier->addAction(mactionExportTexte);
    toolBarFichier->addSeparator();
    toolBarFichier->addAction(mactionRestaurer);
    toolBarFichier->addSeparator();
    toolBarFichier->addAction(mactionSupprimer);
    toolBarFichier->addSeparator();
    toolBarFichier->addAction(actionQuitter);

    /*************************************************************/
    couche = new QHBoxLayout();
    lw = new LeftWindows();
    ow = new OngletWindows();
    couche->addWidget(lw);
    couche->addWidget(ow);
    couche->setMargin(0);
    couche->setAlignment(Qt::AlignTop);
    centerWindows = new QWidget();
    centerWindows->setLayout(couche);
    setCentralWidget(centerWindows);

    //************************** CONNECT **************************/
    QObject::connect(mactionNewArticle, SIGNAL(triggered()), this, SLOT(newArticle()));
    QObject::connect(mactionNewDocument, SIGNAL(triggered()), this, SLOT(newDocument()));
    QObject::connect(mactionNewImage, SIGNAL(triggered()), this, SLOT(newImage()));
    QObject::connect(mactionNewAudio, SIGNAL(triggered()), this, SLOT(newAudio()));
    QObject::connect(mactionNewVideo, SIGNAL(triggered()), this, SLOT(newVideo()));
    QObject::connect(mactionAddTag, SIGNAL(triggered()), this, SLOT(newTag()));
    QObject::connect(mactionOuvrir,SIGNAL(triggered()),this, SLOT(ouvrirDialogue()));
    QObject::connect(actionQuitter,SIGNAL(triggered()),qApp, SLOT(quit()));

    QObject::connect(mactionUp,SIGNAL(triggered()),this, SLOT(docUp()));
    QObject::connect(mactionDown,SIGNAL(triggered()),this, SLOT(docDown()));

    QObject::connect(mactionRestaurer, SIGNAL(triggered()), this, SLOT(ouvrirCorbeille()));

    QObject::connect(mactionSave, SIGNAL(triggered()), this, SLOT(asave()));

    QObject::connect(mactionExportHTML, SIGNAL(triggered()), this, SLOT(exportHTML()));
    QObject::connect(mactionExportTex, SIGNAL(triggered()), this, SLOT(exportTex()));
    QObject::connect(mactionExportTexte, SIGNAL(triggered()), this, SLOT(exportTexte()));

    QObject::connect(mactionSupprimer, SIGNAL(triggered()), this, SLOT(deleteInCorbeille()));
    QObject::connect(mactionVider, SIGNAL(triggered()), this, SLOT(viderLaCorbeille()));
    //TODO
    QObject::connect(mactionAnnuler, SIGNAL(triggered()), qApp, SLOT(undo()));
    QObject::connect(mactionRefaire, SIGNAL(triggered()), qApp, SLOT(redo()));
    //
    QObject::connect(mactionSaveAs, SIGNAL(triggered()), this, SLOT(copieWorkSpace()));
    QObject::connect(mactionNew, SIGNAL(triggered()), this, SLOT(newWorkSpace()));
    QObject::connect(mactionOption, SIGNAL(triggered()), this, SLOT(setting()));



    QObject::connect(mactionViewEdit, SIGNAL(triggered()), this, SLOT(changeEdit()));
    QObject::connect(mactionViewHTML, SIGNAL(triggered()), this, SLOT(changeHtml()));
    QObject::connect(mactionViewTex,SIGNAL(triggered()),this, SLOT(changeTex()));
    QObject::connect(mactionViewTexte,SIGNAL(triggered()),this, SLOT(changeTexte()));
    QObject::connect(ow, SIGNAL(currentChanged(int)), this, SLOT(changeOnglet(int)));
    QObject::connect(mactionSupprimerTag, SIGNAL(triggered()), this, SLOT(supprimeTag()));

}