Ejemplo n.º 1
0
void TextEdit::setupFileActions()
{
    QToolBar *tb = new QToolBar( this );
    QPopupMenu *menu = new QPopupMenu( this );
    menuBar()->insertItem( tr( "&File" ), menu );

    QAction *a;
    a = new QAction( tr( "New" ), QPixmap( "textdrawing/filenew.png" ), tr( "&New..." ), CTRL + Key_N, this, "fileNew" );
    connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) );
    a->addTo( tb );
    a->addTo( menu );
    a = new QAction( tr( "Open" ), QPixmap( "textdrawing/fileopen.png" ), tr( "&Open..." ), CTRL + Key_O, this, "fileOpen" );
    connect( a, SIGNAL( activated() ), this, SLOT( fileOpen() ) );
    a->addTo( tb );
    a->addTo( menu );
    menu->insertSeparator();
    a = new QAction( tr( "Save" ), QPixmap( "textdrawing/filesave.png" ), tr( "&Save..." ), CTRL + Key_S, this, "fileSave" );
    connect( a, SIGNAL( activated() ), this, SLOT( fileSave() ) );
    a->addTo( tb );
    a->addTo( menu );
    a = new QAction( tr( "Save As" ), QPixmap(), tr( "Save &As..." ), 0, this, "fileSaveAs" );
    connect( a, SIGNAL( activated() ), this, SLOT( fileSaveAs() ) );
    a->addTo( menu );
    menu->insertSeparator();
    a = new QAction( tr( "Print" ), QPixmap( "textdrawing/print.png" ), tr( "&Print..." ), CTRL + Key_P, this, "filePrint" );
    connect( a, SIGNAL( activated() ), this, SLOT( filePrint() ) );
    a->addTo( tb );
    a->addTo( menu );
    a = new QAction( tr( "Close" ), QPixmap(), tr( "&Close" ), 0, this, "fileClose" );
    connect( a, SIGNAL( activated() ), this, SLOT( fileClose() ) );
    a->addTo( menu );
}
Ejemplo n.º 2
0
void CoverageView::context(QListViewItem* i, const QPoint & p, int c)
{
  QPopupMenu popup;

  TraceFunction* f = 0;
  if (i) {
      f = _showCallers ?
	  ((CallerCoverageItem*)i)->function() :
	  ((CalleeCoverageItem*)i)->function();
  }

  if (f) {
    QString name = f->name();
    if ((int)name.length()>Configuration::maxSymbolLength())
	name = name.left(Configuration::maxSymbolLength()) + "...";
    popup.insertItem(i18n("Go to '%1'").arg(name), 93);
    popup.insertSeparator();
  }

   if ((c == 0) || (!_showCallers && c == 1)) {
    addCostMenu(&popup, false);
    popup.insertSeparator();
  }
  addGoMenu(&popup); 

  int r = popup.exec(p);
  if (r == 93) activated(f);
}
Ejemplo n.º 3
0
void KonqSidebarBookmarkModule::showPopupMenu()
{
    KonqSidebarBookmarkItem *bi = dynamic_cast<KonqSidebarBookmarkItem*>( tree()->selectedItem() );
    if (!bi)
        return;

    bool tabSupported = tree()->tabSupport();
    QPopupMenu *menu = new QPopupMenu;

    if (bi->bookmark().isGroup()) {
        if (tabSupported) {
            m_collection->action("folder_open_tabs")->plug(menu);
            menu->insertSeparator();
        }
        m_collection->action("create_folder")->plug(menu);
        m_collection->action("delete_folder")->plug(menu);
    } else {
        m_collection->action("open_window")->plug(menu);
        if (tabSupported)
            m_collection->action("open_tab")->plug(menu);
        m_collection->action("copy_location")->plug(menu);
        menu->insertSeparator();
        m_collection->action("create_folder")->plug(menu);
        m_collection->action("delete_bookmark")->plug(menu);
    }
    menu->insertSeparator();
    m_collection->action("item_properties")->plug(menu);

    menu->exec( QCursor::pos() );
    delete menu;
}
Ejemplo n.º 4
0
void SourceView::context(QListViewItem* i, const QPoint & p, int c)
{
  QPopupMenu popup;

  // Menu entry:
  TraceLineCall* lc = i ? ((SourceItem*) i)->lineCall() : 0;
  TraceLineJump* lj = i ? ((SourceItem*) i)->lineJump() : 0;
  TraceFunction* f = lc ? lc->call()->called() : 0;
  TraceLine* line = lj ? lj->lineTo() : 0;

  if (f) {
    QString name = f->name();
    if ((int)name.length()>Configuration::maxSymbolLength())
      name = name.left(Configuration::maxSymbolLength()) + "...";
    popup.insertItem(i18n("Go to '%1'").arg(name), 93);
    popup.insertSeparator();
  }
  else if (line) {
    popup.insertItem(i18n("Go to Line %1").arg(line->name()), 93);
    popup.insertSeparator();
  }

  if ((c == 1) || (c == 2)) {
    addCostMenu(&popup);
    popup.insertSeparator();
  }
  addGoMenu(&popup);

  int r = popup.exec(p);
  if (r == 93) {
    if (f) activated(f);
    if (line) activated(line);
  }
}
Ejemplo n.º 5
0
void dnd::contextMenuEvent ( QContextMenuEvent * )
{

	QString path = INSTALLDIR"images/";

    QString snewtask = path + "add.png";
    QString soptions = path + "preferences.png";  
    QString sabout = path + "about.png";
    QString sexit = path + "exit.png";

    QPixmap pix_newtask(snewtask);
    QPixmap pix_options(soptions);
    QPixmap pix_about(sabout);
    QPixmap pix_exit(sexit);

	QPopupMenu* contextMenu = new QPopupMenu( this );
    Q_CHECK_PTR( contextMenu );
	QLabel *caption = new QLabel(tr("<font color=darkblue><u><b>wdget</b></u></font>"), this );
	caption->setAlignment( Qt::AlignCenter );
	contextMenu->insertSeparator();
	contextMenu->insertItem( caption );
	contextMenu->insertSeparator();
	contextMenu->insertItem(pix_newtask, tr("New task"), dmw, SLOT(fileNewUrl()) );
	contextMenu->insertItem(pix_options, tr("Setting..."), dmw, SLOT(filePref()) );
	contextMenu->insertItem(pix_about,  tr("About..."), dmw, SLOT(helpAbout()) );
	contextMenu->insertItem(pix_exit,  tr("Quit"), dmw, SLOT(fileExit()) );
	contextMenu->exec( QCursor::pos() );
	delete contextMenu;
}
Ejemplo n.º 6
0
SoundPlayer::SoundPlayer() :
    QMainWindow(),
    bucket3("sounds/3.wav"),
    bucket4("sounds/4.wav")
{
    if (!QSound::available()) {
	// Bail out.  Programs in which sound is not critical
	// could just silently (hehe) ignore the lack of a server.
	//
	QMessageBox::warning(this,"No Sound",
		"<p><b>Sorry, you are not running the Network Audio System.</b>"
		"<p>If you have the `au' command, run it in the background before this program. "
		"The latest release of the Network Audio System can be obtained from:"
		"<pre>\n"
		" &nbsp;\n"
		"   ftp.ncd.com:/pub/ncd/technology/src/nas\n"
		"   ftp.x.org:/contrib/audio/nas\n"
		"</pre>"
		"<p>Release 1.2 of NAS is also included with the X11R6"
		"contrib distribution."
		"<p>After installing NAS, you will then need to reconfigure Qt with NAS sound support");
    }

    QPopupMenu *file = new QPopupMenu;
    file->insertItem("Play &1",  this, SLOT(doPlay1()), CTRL+Key_1);
    file->insertItem("Play &2",  this, SLOT(doPlay2()), CTRL+Key_2);
    file->insertItem("Play from bucket &3",  this, SLOT(doPlay3()), CTRL+Key_3);
    file->insertItem("Play from bucket &4",  this, SLOT(doPlay4()), CTRL+Key_4);
    file->insertSeparator();
    file->insertItem("Play 3 and 4 together",  this, SLOT(doPlay34()));
    file->insertItem("Play all together",  this, SLOT(doPlay1234()));
    file->insertSeparator();
    file->insertItem("E&xit",  qApp, SLOT(quit()));
    menuBar()->insertItem("&File", file);
}
Ejemplo n.º 7
0
QPopupMenu* KDiffTextEdit::createPopupMenu( const QPoint& p )
{
  QPopupMenu* popup = QTextEdit::createPopupMenu( p );
  if ( !popup )
    popup = new QPopupMenu( this );

  int i = 0;

  for ( QStringList::Iterator it = extPartsTranslated.begin(); it != extPartsTranslated.end(); ++it ) {
    popup->insertItem( i18n( "Show in %1" ).arg( *it ), i + POPUP_BASE, i );
    i++;
  }
  if ( !extPartsTranslated.isEmpty() )
    popup->insertSeparator( i );
  connect( popup, SIGNAL(activated(int)), this, SLOT(popupActivated(int)) );

  popup->insertItem( SmallIconSet( "filesaveas" ), i18n( "&Save As..." ), this, SLOT(saveAs()), CTRL + Key_S, POPUP_BASE - 2, 0 );
  popup->setItemEnabled( POPUP_BASE - 2, length() > 0 );

  popup->insertSeparator( 1 );

  popup->insertItem( i18n( "Highlight Syntax" ), this, SLOT(toggleSyntaxHighlight()), 0, POPUP_BASE - 1, 2 );
  popup->setItemChecked( POPUP_BASE - 1, _highlight );
  popup->insertSeparator( 3 );

  popup->insertSeparator();
  popup->insertItem( i18n("Hide view"), parent(), SLOT(hideView()) );

  return popup;
}
Ejemplo n.º 8
0
void KonqSidebarHistoryModule::showPopupMenu( int which, const QPoint& pos )
{
    QPopupMenu *sortMenu = new QPopupMenu;
    m_collection->action("byName")->plug( sortMenu );
    m_collection->action("byDate")->plug( sortMenu );

    QPopupMenu *menu = new QPopupMenu;

    if ( which & EntryContextMenu )
    {
        m_collection->action("open_new")->plug( menu );
        menu->insertSeparator();
        m_collection->action("remove")->plug( menu );
    }

    m_collection->action("clear")->plug( menu );
    menu->insertSeparator();
    menu->insertItem( i18n("Sort"), sortMenu );
    menu->insertSeparator();
    m_collection->action("preferences")->plug( menu );

    menu->exec( pos );
    delete menu;
    delete sortMenu;
}
Ejemplo n.º 9
0
void KonqSidebarTree::showToplevelContextMenu()
{
    KonqSidebarTreeTopLevelItem *item = 0;
    KonqSidebarTreeItem *treeItem = currentItem();
    if (treeItem && treeItem->isTopLevelItem())
        item = static_cast<KonqSidebarTreeTopLevelItem *>(treeItem);

    if (!m_collection)
    {
        m_collection = new KActionCollection( this, "bookmark actions" );
        (void) new KAction( i18n("&Create New Folder..."), "folder_new", 0, this,
                            SLOT( slotCreateFolder() ), m_collection, "create_folder");
        (void) new KAction( i18n("Delete Folder"), "editdelete", 0, this,
                            SLOT( slotDelete() ), m_collection, "delete_folder");
        (void) new KAction( i18n("Rename"), 0, this,
                            SLOT( slotRename() ), m_collection, "rename");
        (void) new KAction( i18n("Delete Link"), "editdelete", 0, this,
                            SLOT( slotDelete() ), m_collection, "delete_link");
        (void) new KAction( i18n("Properties"), "edit", 0, this,
                            SLOT( slotProperties() ), m_collection, "item_properties");
        (void) new KAction( i18n("Open in New Window"), "window_new", 0, this,
                            SLOT( slotOpenNewWindow() ), m_collection, "open_window");
        (void) new KAction( i18n("Open in New Tab"), "tab_new", 0, this,
                            SLOT( slotOpenTab() ), m_collection, "open_tab");
        (void) new KAction( i18n("Copy Link Address"), "editcopy", 0, this,
                            SLOT( slotCopyLocation() ), m_collection, "copy_location");
    }

    QPopupMenu *menu = new QPopupMenu;

    if (item) {
        if (item->isTopLevelGroup()) {
            m_collection->action("rename")->plug(menu);
            m_collection->action("delete_folder")->plug(menu);
            menu->insertSeparator();
            m_collection->action("create_folder")->plug(menu);
        } else {
            if (tabSupport())
                m_collection->action("open_tab")->plug(menu);
            m_collection->action("open_window")->plug(menu);
            m_collection->action("copy_location")->plug(menu);
            menu->insertSeparator();
            m_collection->action("rename")->plug(menu);
            m_collection->action("delete_link")->plug(menu);
        }
        menu->insertSeparator();
        m_collection->action("item_properties")->plug(menu);
    } else {
        m_collection->action("create_folder")->plug(menu);
    }

    m_currentTopLevelItem = item;

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

    m_currentTopLevelItem = 0;
}
Ejemplo n.º 10
0
void KURLBar::slotContextMenuRequested(QListBoxItem *_item, const QPoint &pos)
{
    if(m_isImmutable)
        return;

    KURLBarItem *item = dynamic_cast< KURLBarItem * >(_item);

    static const int IconSize = 10;
    static const int AddItem = 20;
    static const int EditItem = 30;
    static const int RemoveItem = 40;

    KURL lastURL = m_activeItem ? m_activeItem->url() : KURL();

    bool smallIcons = m_iconSize < KIcon::SizeMedium;
    QPopupMenu *popup = new QPopupMenu();
    popup->insertItem(smallIcons ? i18n("&Large Icons") : i18n("&Small Icons"), IconSize);
    popup->insertSeparator();

    if(item != 0L && item->isPersistent())
    {
        popup->insertItem(SmallIconSet("edit"), i18n("&Edit Entry..."), EditItem);
        popup->insertSeparator();
    }

    popup->insertItem(SmallIconSet("filenew"), i18n("&Add Entry..."), AddItem);

    if(item != 0L && item->isPersistent())
    {
        popup->insertItem(SmallIconSet("editdelete"), i18n("&Remove Entry"), RemoveItem);
    }

    int result = popup->exec(pos);
    switch(result)
    {
        case IconSize:
            setIconSize(smallIcons ? KIcon::SizeMedium : KIcon::SizeSmallMedium);
            m_listBox->triggerUpdate(true);
            break;
        case AddItem:
            addNewItem();
            break;
        case EditItem:
            editItem(static_cast< KURLBarItem * >(item));
            break;
        case RemoveItem:
            delete item;
            m_isModified = true;
            break;
        default: // abort
            break;
    }

    // reset current item
    m_activeItem = 0L;
    setCurrentItem(lastURL);
}
void
SupplierAdmin::contextMenu(QPopupMenu& _menu)
{
  _menu.insertItem("Create supplier", this, SLOT(createProxyPushConsumer()));
  _menu.insertSeparator();
  notifyPublish_->contextMenu(_menu);
  _menu.insertSeparator();
  _menu.insertItem("Destroy", this, SLOT(destroy()));
}
void
ParameterXML::contextMenu(QPopupMenu& _menu)
{
  _menu.insertItem("Set Parameters", this, SLOT(slotSetParameters()));
  _menu.insertSeparator();
  _menu.insertItem("Up", this, SLOT(up()));
  _menu.insertItem("Down", this, SLOT(down()));
  _menu.insertSeparator();
  _menu.insertItem("Delete", this, SLOT(slotDelete()));
}
Ejemplo n.º 13
0
QPopupMenu *KLineEdit::createPopupMenu()
{
    enum { IdUndo, IdRedo, IdSep1, IdCut, IdCopy, IdPaste, IdClear, IdSep2, IdSelectAll };

    QPopupMenu *popup = QLineEdit::createPopupMenu();

      int id = popup->idAt(0);
      popup->changeItem( id - IdUndo, SmallIconSet("undo"), popup->text( id - IdUndo) );
      popup->changeItem( id - IdRedo, SmallIconSet("redo"), popup->text( id - IdRedo) );
      popup->changeItem( id - IdCut, SmallIconSet("editcut"), popup->text( id - IdCut) );
      popup->changeItem( id - IdCopy, SmallIconSet("editcopy"), popup->text( id - IdCopy) );
      popup->changeItem( id - IdPaste, SmallIconSet("editpaste"), popup->text( id - IdPaste) );
      popup->changeItem( id - IdClear, SmallIconSet("editclear"), popup->text( id - IdClear) );

    // If a completion object is present and the input
    // widget is not read-only, show the Text Completion
    // menu item.
    if ( compObj() && !isReadOnly() && kapp->authorize("lineedit_text_completion") )
    {
        QPopupMenu *subMenu = new QPopupMenu( popup );
        connect( subMenu, SIGNAL( activated( int ) ),
                 this, SLOT( completionMenuActivated( int ) ) );

        popup->insertSeparator();
        popup->insertItem( SmallIconSet("completion"), i18n("Text Completion"),
                           subMenu );

        subMenu->insertItem( i18n("None"), NoCompletion );
        subMenu->insertItem( i18n("Manual"), ShellCompletion );
        subMenu->insertItem( i18n("Automatic"), AutoCompletion );
        subMenu->insertItem( i18n("Dropdown List"), PopupCompletion );
        subMenu->insertItem( i18n("Short Automatic"), ShortAutoCompletion );
        subMenu->insertItem( i18n("Dropdown List && Automatic"), PopupAutoCompletion );

        subMenu->setAccel( KStdAccel::completion(), ShellCompletion );

        KGlobalSettings::Completion mode = completionMode();
        subMenu->setItemChecked( NoCompletion,
                                 mode == KGlobalSettings::CompletionNone );
        subMenu->setItemChecked( ShellCompletion,
                                 mode == KGlobalSettings::CompletionShell );
        subMenu->setItemChecked( PopupCompletion,
                                 mode == KGlobalSettings::CompletionPopup );
        subMenu->setItemChecked( AutoCompletion,
                                 mode == KGlobalSettings::CompletionAuto );
        subMenu->setItemChecked( ShortAutoCompletion,
                                 mode == KGlobalSettings::CompletionMan );
        subMenu->setItemChecked( PopupAutoCompletion,
                                 mode == KGlobalSettings::CompletionPopupAuto );
        if ( mode != KGlobalSettings::completionMode() )
        {
            subMenu->insertSeparator();
            subMenu->insertItem( i18n("Default"), Default );
        }
    }
Ejemplo n.º 14
0
Editor::Editor( QWidget * parent , const char * name )
    : QWidget( parent, name, WDestructiveClose )
{
    m = new QMenuBar( this, "menu" );

    QPopupMenu * file = new QPopupMenu();
    Q_CHECK_PTR( file );
    m->insertItem( "&File", file );

    file->insertItem( "&New",   this, SLOT(newDoc()),   ALT+Key_N );
    file->insertItem( "&Open...",  this, SLOT(load()),     ALT+Key_O );
    file->insertItem( "&Save...",  this, SLOT(save()),     ALT+Key_S );
    file->insertSeparator();
    open_as = new QPopupMenu();
    file->insertItem( "Open &As",  open_as );
    save_as = new QPopupMenu();
    file->insertItem( "Sa&ve As",  save_as );
    file->insertItem( "Add &Encoding", this, SLOT(addEncoding()) );    
#ifndef QT_NO_PRINTER
    file->insertSeparator();
    file->insertItem( "&Print...", this, SLOT(print()),    ALT+Key_P );
#endif
    file->insertSeparator();
    file->insertItem( "&Close", this, SLOT(close()),ALT+Key_W );
    file->insertItem( "&Quit",  qApp, SLOT(closeAllWindows()),     ALT+Key_Q );

    connect( save_as, SIGNAL(activated(int)), this, SLOT(saveAsEncoding(int)) );
    connect( open_as, SIGNAL(activated(int)), this, SLOT(openAsEncoding(int)) );
    rebuildCodecList();

    QPopupMenu * edit = new QPopupMenu();
    Q_CHECK_PTR( edit );
    m->insertItem( "&Edit", edit );

    edit->insertItem( "To &Uppercase",   this, SLOT(toUpper()),   ALT+Key_U );
    edit->insertItem( "To &Lowercase",   this, SLOT(toLower()),   ALT+Key_L );
#ifndef QT_NO_FONTDIALOG
    edit->insertSeparator();
    edit->insertItem( "&Select Font" ,	 this, SLOT(font()),     ALT+Key_T );
#endif
    changed = FALSE;
    e = new QMultiLineEdit( this, "editor" );
    connect( e, SIGNAL( textChanged() ), this, SLOT( textChanged() ) );

    // We use Unifont - if you have it installed you'll see all
    // Unicode character glyphs.
    //
    // Unifont only comes in one pixel size, so we cannot let
    // it change pixel size as the display DPI changes.
    //
    QFont unifont("unifont",16,50); unifont.setPixelSize(16);
    e->setFont( unifont );

    e->setFocus();
}
QPopupMenu *CInnoDBStatus::createPopupMenu(const QPoint &)
{
  QPopupMenu *menu = new QPopupMenu(this);
  int copy_id = menu->insertItem(getPixmapIcon("copyIcon"), tr("&Copy"), this, SLOT(copy()));
  menu->setItemEnabled(copy_id, hasSelectedText());
  menu->insertSeparator();
  menu->insertItem(getPixmapIcon("saveIcon"), tr("&Save"), this, SLOT(save()));
  menu->insertSeparator();
  menu->insertItem(getPixmapIcon("refreshIcon"), tr("&Refresh"), this, SLOT(refresh()));
  return menu;
}
void
PatternWidgetClass::mousePressEvent(QMouseEvent* event) 
{
  // left button //
  if (event->button() == LeftButton) {

    // are we in the addTransitionMode ? //
    if (getView().isAddTransitionMode()) {
      getView().endAddTransition(this);
    }

    // else, save the click position for a possible move //
    else {
      pickedPos = event->pos();
    }
  }


  // right button -> popup menu //
  else if (event->button() == RightButton) {

    // popup menu //
    QPopupMenu menu;
    menuAddBehaviour_ = new QPopupMenu(&menu);

    menu.insertItem("Start pattern",  this, SLOT(onSetStart()));
    menu.insertSeparator();
    menu.insertItem("Add behaviour",  menuAddBehaviour_);
    menu.insertItem("Add transition", this, SLOT(onAddTransition()));
    menu.insertSeparator();
    menu.insertItem("Rename pattern", this, SLOT(onRenamePattern()));
    menu.insertItem("Rename transition", this, SLOT(onRenameTransition()));
    menu.insertItem("Delete pattern", this, SLOT(onDelete()));

    // submenu: add all behaviour names //
    Generator::GroupMap::const_iterator first, last;
    PolicyConfigClass::instance()->description().getGroupedClasses("behaviour", first, last);
    for (; first != last; ++first) {
      if (first->second.isFinal() &&
	  !getDocument().hasBehaviour(patternName, first->second.name())) {
        menuAddBehaviour_->insertItem(first->second.name());
      }
    }
    connect(menuAddBehaviour_, SIGNAL(activated(int)), this, SLOT(onAddBehaviour(int)));

    // show popup menu
    menu.exec(QCursor::pos());
  }
Ejemplo n.º 17
0
void VCFrame::invokeMenu(QPoint point)
{
	QPopupMenu* menu = VCWidget::createMenu();

	// Add menu
	QPopupMenu* addMenu = new QPopupMenu(menu);
	addMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/button.png")),
			    "&Button", KVCMenuAddButton);
	addMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/slider.png")),
			    "&Slider", KVCMenuAddSlider);
	addMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/frame.png")),
			    "&Frame", KVCMenuAddFrame);
	addMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/xypad.png")),
			    "&XY-Pad", KVCMenuAddXYPad);
	addMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/label.png")),
			    "L&abel", KVCMenuAddLabel);

	menu->insertSeparator();

	menu->insertItem("Add", addMenu);

	connect(addMenu, SIGNAL(activated(int)),
		this, SLOT(slotMenuCallback(int)));

	menu->exec(point);

	delete menu;
}
Ejemplo n.º 18
0
void VMemo::mousePressEvent( QMouseEvent *me ) {
    if(!recording) {
        QPopupMenu * menu = new QPopupMenu( this );
        menu->insertItem( tr( "Start recording" ), 0 );
        menu->insertSeparator();
        menu->insertItem( tr( "Settings..." ), 1 );
        QPoint p = mapToGlobal( QPoint( 0, 0 ) );
        QSize s = menu->sizeHint();
        int opt = menu->exec( QPoint( p.x() + ( width() / 2 ) - ( s.width() / 2 ),
                                    p.y() - s.height() ), 0 );

        if ( opt == 0 ) {
            if(!startRecording() ){
                QMessageBox::critical(0, tr("vmemo"), tr("Recording aborted"));
            }
        }
        else if ( opt == 1 ) {
            // Show vmemo settings
            QCopEnvelope e("QPE/Application/sound", "raise()" );
        }

        delete menu;
    }
    else {
        stopRecording();
    }
}
Ejemplo n.º 19
0
void CTableFieldChooserListView::displayMenu( QListViewItem *, const QPoint &pos, int )
{
  QPopupMenu *menu = new QPopupMenu();
  menu->insertItem(getPixmapIcon("checkedIcon"), tr("Check All"), 1);
  menu->insertItem(getPixmapIcon("uncheckedIcon"), tr("Clear All"), 2);
  menu->insertSeparator();
  menu->insertItem(getPixmapIcon("refreshTablesIcon"), "Refresh", MENU_REFRESH);
  int res = menu->exec(pos);
  delete menu;
  bool b = false;
  switch (res)
  {
  case 1: b = true;
    break;
  case 2: b = false;
    break;
  case MENU_REFRESH:
    refresh();
    break;
  }

  if (res != MENU_REFRESH)
  {
    QListViewItemIterator it(this);
    for ( ; it.current(); ++it)
      ((CTableFieldChooserListItem *)it.current())->setOn(b);
  }  
}
Ejemplo n.º 20
0
void TextEdit::setupEditActions()
{
    QToolBar *tb = new QToolBar( this );
    tb->setLabel( "Edit Actions" );
    QPopupMenu *menu = new QPopupMenu( this );
    menuBar()->insertItem( tr( "&Edit" ), menu );

    QAction *a;
    a = new QAction( QPixmap::fromMimeSource( "editundo.xpm" ), tr( "&Undo" ), CTRL + Key_Z, this, "editUndo" );
    connect( a, SIGNAL( activated() ), this, SLOT( editUndo() ) );
    a->addTo( tb );
    a->addTo( menu );
    a = new QAction( QPixmap::fromMimeSource( "editredo.xpm" ), tr( "&Redo" ), CTRL + Key_Y, this, "editRedo" );
    connect( a, SIGNAL( activated() ), this, SLOT( editRedo() ) );
    a->addTo( tb );
    a->addTo( menu );
    menu->insertSeparator();
    a = new QAction( QPixmap::fromMimeSource( "editcopy.xpm" ), tr( "&Copy" ), CTRL + Key_C, this, "editCopy" );
    connect( a, SIGNAL( activated() ), this, SLOT( editCopy() ) );
    a->addTo( tb );
    a->addTo( menu );
    a = new QAction( QPixmap::fromMimeSource( "editcut.xpm" ), tr( "Cu&t" ), CTRL + Key_X, this, "editCut" );
    connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) );
    a->addTo( tb );
    a->addTo( menu );
    a = new QAction( QPixmap::fromMimeSource( "editpaste.xpm" ), tr( "&Paste" ), CTRL + Key_V, this, "editPaste" );
    connect( a, SIGNAL( activated() ), this, SLOT( editPaste() ) );
    a->addTo( tb );
    a->addTo( menu );
}
PatternsMainWindow::PatternsMainWindow(QWidget* parent, const char* name) 
:QMainWindow(parent, name), p_arr(NULL), size(0),
 min_x(0), max_x(32768), min_y(0), max_y(32768) {
    //Set size
    setMinimumSize(600, 400);
    //Create File Menu
    //File Menu Begin
    QPopupMenu* file = new QPopupMenu(this);

    //Create Load and Calculate Section
    file->insertItem("&Load input file", this, SLOT(OnLoadFile()), CTRL+Key_N);
    file->insertItem("Load &Brute Algorithm", this, SLOT(OnLoadBrute()), CTRL+Key_B);
    file->insertItem("Load &Fast Algorithm", this, SLOT(OnLoadFast()), CTRL+Key_F);
    file->insertSeparator();
    
    //Create Exit Section
    file->insertItem("&Exit", this, SLOT(OnExit()), CTRL+Key_X);

    //Insert File Menu
    menuBar()->insertItem("&File", file);
    //File Menu End

    //Create Help Menu
    //Help Menu Begin
    QPopupMenu* help = new QPopupMenu(this);
    
    //Create Help items
    help->insertItem("&About", this, SLOT(ShowAbout()));
    
    //Insert Help Menu
    menuBar()->insertItem("&Help", help);
    //Help Menu End
}
Ejemplo n.º 22
0
int main( int argc, char **argv )
{
    QApplication app( argc, argv );

    QMainWindow mw;
    app.setMainWidget( &mw );

    QPopupMenu menu2;
    menu2.insertItem( "Test 2" );
    TrayIcon tray2( QPixmap( (const char**)minimize_xpm ), "Minimize MainWindow", &menu2 );
    QObject::connect(&tray2,SIGNAL(clicked(const QPoint&)),&mw,SLOT(showMinimized()));

    QPopupMenu menu;
    menu.insertItem( "Test 1" );
    menu.insertSeparator();
    menu.insertItem( "&Quit", &app, SLOT(quit()) );
    TrayIcon tray( QPixmap( (const char**)normalize_xpm ), "Show MainWindow", &menu );
    QObject::connect(&tray,SIGNAL(clicked(const QPoint&)),&mw,SLOT(showNormal()));

    TrayIcon tray3( QPixmap( (const char**)maximize_xpm ), "Maximize MainWindow" );
    QObject::connect(&tray3,SIGNAL(clicked(const QPoint&)),&mw,SLOT(showMaximized()));

    mw.show();
    tray.show();
    tray2.show();
    tray3.show();

    return app.exec();
}
Ejemplo n.º 23
0
void ScenarioInterface::initMenuBar()
{
	QPopupMenu * menuFile = new QPopupMenu();
	menuFile->insertItem( "New", FILE_NEW );
	menuFile->insertItem( "Open", FILE_OPEN );
	menuFile->insertItem( "Save", FILE_SAVE );
	menuFile->insertItem( "Save as", FILE_SAVEAS );
	menuFile->insertSeparator();
	menuFile->insertItem( "Quit", FILE_QUIT );
	connect( menuFile, SIGNAL( activated( int ) ), this, SLOT( slot_menuFileActivated( int ) ) );

	QPopupMenu * menuScen = new QPopupMenu();
	menuScen->insertItem( "Scenario Information", SCEN_INFO );
	connect( menuScen, SIGNAL( activated( int ) ), this, SLOT( slot_menuScenActivated( int ) ) );

	QPopupMenu * menuTools = new QPopupMenu();
	menuTools->insertItem( "Clear screen", TOOL_CLEAR );
	menuTools->insertItem( "Fill screen", TOOL_FILL );
	connect( menuTools, SIGNAL( activated( int ) ), this, SLOT( slot_menuToolsActivated( int ) ) );

	QPopupMenu * menuHelp = new QPopupMenu();
	menuHelp->insertItem( "Help", HELP_INFO );
	connect( menuHelp, SIGNAL( activated( int ) ), this, SLOT( slot_menuHelpActivated( int ) ) );

	menuBar()->insertItem( "&File", menuFile );
	menuBar()->insertItem( "&Scenario", menuScen );
	menuBar()->insertItem( "&Tools", menuTools );
	menuBar()->insertItem( "&Help", menuHelp );
}
Ejemplo n.º 24
0
void TextEdit::setupEditActions()
{
    QToolBar *tb = new QToolBar( this );
    QPopupMenu *menu = new QPopupMenu( this );
    menuBar()->insertItem( tr( "&Edit" ), menu );

    QAction *a;
    a = new QAction( tr( "Undo" ), QPixmap( "textdrawing/undo.png" ), tr( "&Undo" ), CTRL + Key_Z, this, "editUndo" );
    connect( a, SIGNAL( activated() ), this, SLOT( editUndo() ) );
    a->addTo( tb );
    a->addTo( menu );
    a = new QAction( tr( "Redo" ), QPixmap( "textdrawing/redo.png" ), tr( "&Redo" ), CTRL + Key_Y, this, "editRedo" );
    connect( a, SIGNAL( activated() ), this, SLOT( editRedo() ) );
    a->addTo( tb );
    a->addTo( menu );
    menu->insertSeparator();
    a = new QAction( tr( "Cut" ), QPixmap( "textdrawing/editcut.png" ), tr( "&Cut" ), CTRL + Key_X, this, "editCut" );
    connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) );
    a->addTo( tb );
    a->addTo( menu );
    a = new QAction( tr( "Copy" ), QPixmap( "textdrawing/editcopy.png" ), tr( "C&opy" ), CTRL + Key_C, this, "editCopy" );
    connect( a, SIGNAL( activated() ), this, SLOT( editCopy() ) );
    a->addTo( tb );
    a->addTo( menu );
    a = new QAction( tr( "Paste" ), QPixmap( "textdrawing/editpaste.png" ), tr( "&Paste" ), CTRL + Key_V, this, "editPaste" );
    connect( a, SIGNAL( activated() ), this, SLOT( editPaste() ) );
    a->addTo( tb );
    a->addTo( menu );
}
Ejemplo n.º 25
0
void ABMainWindow::setupMenuBar()
{
    QPopupMenu *file = new QPopupMenu( this );
    menuBar()->insertItem( "&File", file );

    file->insertItem( "New", this, SLOT( fileNew() ), CTRL + Key_N );
    file->insertItem( QPixmap( "fileopen.xpm" ), "Open", this, SLOT( fileOpen() ), CTRL + Key_O );
    file->insertSeparator();
    file->insertItem( QPixmap( "filesave.xpm" ), "Save", this, SLOT( fileSave() ), CTRL + Key_S );
    file->insertItem( "Save As...", this, SLOT( fileSaveAs() ) );
    file->insertSeparator();
    file->insertItem( QPixmap( "fileprint.xpm" ), "Print...", this, SLOT( filePrint() ), CTRL + Key_P );
    file->insertSeparator();
    file->insertItem( "Close", this, SLOT( closeWindow() ), CTRL + Key_W );
    file->insertItem( "Quit", qApp, SLOT( quit() ), CTRL + Key_Q );
}
Ejemplo n.º 26
0
PoleView::PoleView(): QMainWindow()
{
  storage = 0;
  
  view = new QListView( this );
  view->addColumn( tr("Name" ) );
  view->addColumn( tr("Size" ) );
  view->setColumnAlignment( 1, Qt::AlignRight );
  setCentralWidget( view );
  
  QPopupMenu * file = new QPopupMenu( this );
  menuBar()->insertItem( tr("&File"), file );
  file->insertItem( tr("&New Window"), this, SLOT(newWindow()), CTRL+Key_N );
  file->insertItem( tr("&Open..."), this, SLOT(choose()), CTRL+Key_O );
  file->insertItem( tr("&Close"), this, SLOT(closeFile()) );
  file->insertSeparator();
  file->insertItem( tr("&Quit"), qApp, SLOT( closeAllWindows() ), CTRL+Key_Q );

  QPopupMenu * streamMenu = new QPopupMenu( this );
  menuBar()->insertItem( tr("&Stream"), streamMenu );
  streamMenu->insertItem( tr("&Export..."), this, SLOT(exportStream() ), CTRL+Key_E );
  streamMenu->insertItem( tr("&View..."), this, SLOT(viewStream()) );
    
  QPopupMenu * help = new QPopupMenu( this );
  menuBar()->insertItem( tr("&Help"), help );
  help->insertItem( tr("&About"), this, SLOT(about()), Key_F1 );
  help->insertItem( tr("About &Qt"), this, SLOT(aboutQt()) );
  
  resize( 400, 300 );
  setCaption( tr("POLEView" ) );
  statusBar()->message( tr("Ready"), 5000 );
}
Ejemplo n.º 27
0
void SBookWidget::CreateMenuBar(QLayout *topLayout)
{
    QMenuBar *menubar = new QMenuBar( this );
    menubar->setSeparator( QMenuBar::InWindowsStyle );


    QPopupMenu *file = new QPopupMenu;
    file->insertItem( "&New File", this, SLOT(menuFileNew()) );
    file->insertItem( "&Open", this, SLOT(menuFileOpen()),CTRL+Key_O );
    file->insertSeparator();
    file->insertItem( "&Save",    this, SLOT(menuSave()),CTRL+Key_S );
    file->insertItem( "Save &As ...", this, SLOT(menuSaveAs()));
    file->insertItem( "E&xport ...", this, SLOT(menuExport()));
    file->insertItem( "I&mport ...",   this, SLOT(menuImport()));
    file->insertSeparator();
    file->insertItem( "&Print ...",   this, SLOT(menuFilePrint()), CTRL+Key_P);
    file->insertItem( "&Setup Label Printer ...", this, SLOT(menuFileSetupLabelPrinter()));
    file->insertSeparator();
    file->insertItem( "&Inspector", this, SLOT(menuShowInspector()),CTRL+SHIFT+Key_I);
    file->insertItem( "&Exit", this, SLOT(menuFileExit()) );
    menubar->insertItem( "&File", file );

    /*************/
    /*   ENTRY   */
    /*************/
    QPopupMenu *entry = new QPopupMenu;
    entry->insertItem( "&New Entry",	this, SLOT(menuEntryNew()),CTRL+Key_N );
    entry->insertItem( "&Delete Entry", this, SLOT(menuEntryDelete()),CTRL+Key_D );
    entry->insertItem( "&Find Entry",	this, SLOT(menuFind()), CTRL+Key_F );
    entry->insertSeparator();
    entry->insertItem( "&Send Email",	this, SLOT(sendEmail()), CTRL+Key_E );
    entry->insertItem( "Print &Label ...", this, SLOT(menuFilePrintLabel()), CTRL+Key_L);
    entry->insertItem( "Print Label 2 ...", this, SLOT(menuFilePrintLabel2()), CTRL+SHIFT+Key_L);

    menubar->insertItem( "&Entry", entry);
    /****************************************************************/

    QPopupMenu *help = new QPopupMenu;
    help->insertItem( "&About " APP_NAME " " APP_VERSION,
		      this, SLOT(menuAbout()) );
    help->insertSeparator();
    help->insertItem( "About &Qt"       , this, SLOT(menuAboutQt()) );
    menubar->insertItem( "&Help",help);

    // ...and tell the layout about it.
    topLayout->setMenuBar( menubar );
}
Ejemplo n.º 28
0
/**
 * Set a value to a min/max/reverse column using a context menu
 */
void VCXYPadProperties::slotContextMenuRequested(QListViewItem* item,
        const QPoint &point,
        int column)
{
    int result;
    QString s;

    if (column == KColumnLo)
    {
        result = invokeDMXValueMenu(point);

        if (result <= KChannelValueMax &&
                result >= KChannelValueMin)
        {
            s.sprintf("%.3d", result);
            item->setText(KColumnLo, s);

            slotSelectionXChanged(m_listX->currentItem());
            slotSelectionYChanged(m_listY->currentItem());
        }
    }
    else if (column == KColumnHi)
    {
        result = invokeDMXValueMenu(point);

        if (result <= KChannelValueMax &&
                result >= KChannelValueMin)
        {
            s.sprintf("%.3d", result);
            item->setText(KColumnHi, s);

            slotSelectionXChanged(m_listX->currentItem());
            slotSelectionYChanged(m_listY->currentItem());
        }
    }
    else if (column == KColumnReverse)
    {
        QPopupMenu* menu = new QPopupMenu();
        menu->insertItem("Reverse", KNoID);
        menu->insertSeparator();
        menu->insertItem(Settings::trueValue(), KComboItemReverse);
        menu->insertItem(Settings::falseValue(), KComboItemNormal);

        result = menu->exec(point);
        if (result == KComboItemNormal)
        {
            item->setText(KColumnReverse, Settings::falseValue());
        }
        else if (result == KComboItemReverse)
        {
            item->setText(KColumnReverse, Settings::trueValue());
        }

        slotSelectionXChanged(m_listX->currentItem());
        slotSelectionYChanged(m_listY->currentItem());

        delete menu;
    }
}
Ejemplo n.º 29
0
QPopupMenu *Editor::createPopupMenu( const QPoint &p )
{
    QPopupMenu *menu = QTextEdit::createPopupMenu( p );
    menu->insertSeparator();
    menu->insertItem( tr( "C&omment Code\tAlt+C" ), this, SLOT( commentSelection() ) );
    menu->insertItem( tr( "Unco&mment Code\tAlt+U" ), this, SLOT( uncommentSelection() ) );
    return menu;
}
Ejemplo n.º 30
0
bool KonqSidebarBookmarkModule::handleTopLevelContextMenu( KonqSidebarTreeTopLevelItem *, const QPoint& ) 
{
    QPopupMenu *menu = new QPopupMenu;

    if (tree()->tabSupport()) {
	m_collection->action("folder_open_tabs")->plug(menu);
	menu->insertSeparator();
    }
    m_collection->action("create_folder")->plug(menu);
 
    menu->insertSeparator();
    m_collection->action("edit_bookmarks")->plug(menu);

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

    return true;
}