예제 #1
0
/*

Scribble::Scribble( QWidget *parent, const char *name )
    : QMainWindow( parent, name )
{
    canvas = new Canvas( this );
    setCentralWidget( canvas );

    QToolBar *tools = new QToolBar( this );

    bSave = new QPushButton( "Save as...", tools );

    tools->addSeparator();

    bPColor = new QPushButton( "Choose Pen Color...", tools );
    //    bPColor->setText( "Choose Pen Color..." );

    tools->addSeparator();

    bPWidth = new QSpinBox( 1, 20, 1, tools );
    QToolTip::add( bPWidth, "Choose Pen Width" );
    connect( bPWidth, SIGNAL( valueChanged( int ) ), this, SLOT( slotWidth( int ) ) );
    bPWidth->setValue( 3 );

    tools->addSeparator();

    bClear = new QPushButton( "Clear Screen", tools );
    QObject::connect( bSave, SIGNAL( clicked() ), this, SLOT( slotSave() ) );
    QObject::connect( bPColor, SIGNAL( clicked() ), this, SLOT( slotColor() ) );
    QObject::connect( bClear, SIGNAL( clicked() ), this, SLOT( slotClear() ) );
		
}

  */
void Scribble::slotSave()
{
    QPopupMenu *menu = new QPopupMenu( 0 );
    QIntDict<QString> formats;
    formats.setAutoDelete( TRUE );

    for ( unsigned int i = 0; i < QImageIO::outputFormats().count(); i++ ) {
	QString str = QString( QImageIO::outputFormats().at( i ) );
	formats.insert( menu->insertItem( QString( "%1..." ).arg( str ) ), new QString( str ) );
    }

    menu->setMouseTracking( TRUE );
    int id = menu->exec( bSave->mapToGlobal( QPoint( 0, bSave->height() + 1 ) ) );

    if ( id != -1 ) {
	QString format = *formats[ id ];

	QString filename = QFileDialog::getSaveFileName( QString::null, QString( "*.%1" ).arg( format.lower() ), this );
	if ( !filename.isEmpty() )
	    canvas->save( filename, format );
    }

    delete menu;
}
예제 #2
0
void KOEditorFreeBusy::showAttendeeStatusMenu()
{
  if ( mGanttView->mapFromGlobal( QCursor::pos() ).x() > 22 )
    return;
  QPopupMenu popup;
  popup.insertItem( SmallIcon( "help" ), Attendee::statusName( Attendee::NeedsAction ), Attendee::NeedsAction );
  popup.insertItem( KOGlobals::self()->smallIcon( "ok" ), Attendee::statusName( Attendee::Accepted ), Attendee::Accepted );
  popup.insertItem( KOGlobals::self()->smallIcon( "no" ), Attendee::statusName( Attendee::Declined ), Attendee::Declined );
  popup.insertItem( KOGlobals::self()->smallIcon( "apply" ), Attendee::statusName( Attendee::Tentative ), Attendee::Tentative );
  popup.insertItem( KOGlobals::self()->smallIcon( "mail_forward" ), Attendee::statusName( Attendee::Delegated ), Attendee::Delegated );
  popup.insertItem( Attendee::statusName( Attendee::Completed ), Attendee::Completed );
  popup.insertItem( KOGlobals::self()->smallIcon( "help" ), Attendee::statusName( Attendee::InProcess ), Attendee::InProcess );
  popup.setItemChecked( currentAttendee()->status(), true );
  int status = popup.exec( QCursor::pos() );
  if ( status >= 0 ) {
    currentAttendee()->setStatus( (Attendee::PartStat)status );
    updateCurrentItem();
    updateAttendeeInput();
  }
}
예제 #3
0
파일: interfaceDuel.cpp 프로젝트: q4a/attal
void InterfaceDuel::initMenuBar()
{
	QPopupMenu * menuFile = new QPopupMenu();
	CHECK_PTR( menuFile );
	menuFile->insertItem( "Load Game", FIL_LOAD );
	menuFile->insertItem( "Save Game", FIL_SAVE );
	menuFile->insertItem( "Start Game", FIL_START );
	menuFile->insertItem( "End Game", FIL_END );	
	menuFile->insertItem( "Quit", FIL_QUIT );
	connect( menuFile, SIGNAL( activated( int ) ), this, SLOT( slot_menuFileActivated( int ) ) );	
	
	QPopupMenu * menuGame = new QPopupMenu();
	CHECK_PTR( menuGame );
	menuGame->insertItem( "Fight", GAM_FIG );
	menuGame->insertItem( "End Fight", GAM_END );
	connect( menuGame, SIGNAL( activated( int ) ), this, SLOT( slot_menuGameActivated( int ) ) );
	
	menuBar()->insertItem( "&File", menuFile );
	menuBar()->insertItem( "&Game", menuGame );
}
예제 #4
0
void VirtualConsole::initMenuBar()
{
    QString dir;
    _app->settings()->get(KEY_SYSTEM_DIR, dir);
    dir += QString("/") + PIXMAPPATH;

    setIcon(dir + QString("/virtualconsole.xpm"));

    m_layout = new QHBoxLayout(this);
    m_layout->setAutoAdd(false);

    m_menuBar = new QMenuBar(this);
    m_layout->setMenuBar(m_menuBar);

    //
    // Add menu
    //
    m_addMenu = new QPopupMenu();
    m_addMenu->insertItem(QPixmap(dir + "/button.xpm"),
                          "&Button", this, SLOT(slotAddButton()),
                          0, KVCMenuAddButton);
    m_addMenu->insertItem(QPixmap(dir + "/slider.xpm"),
                          "&Slider", this, SLOT(slotAddSlider()),
                          0, KVCMenuAddSlider);
    m_addMenu->insertItem(QPixmap(dir + "/frame.xpm"),
                          "&Frame", this, SLOT(slotAddFrame()),
                          0, KVCMenuAddFrame);
    m_addMenu->insertItem(QPixmap(dir + "/frame.xpm"),
                          "&XY-Pad", this, SLOT(slotAddXYPad()),
                          0, KVCMenuAddXYPad);
    m_addMenu->setItemEnabled(KVCMenuAddXYPad, false);
    m_addMenu->insertItem(QPixmap(dir + "/rename.xpm"),
                          "L&abel", this, SLOT(slotAddLabel()),
                          0, KVCMenuAddLabel);

    //
    // Tools menu
    //
    m_toolsMenu = new QPopupMenu();
    m_toolsMenu->insertItem(QPixmap(dir + "/settings.xpm"),
                            "&Settings...", this, SLOT(slotToolsSettings()),
                            0, KVCMenuToolsSettings);
    m_toolsMenu->insertItem(QPixmap(dir + "/slider.xpm"),
                            "&Default Sliders", this, SLOT(slotToolsSliders()),
                            0, KVCMenuToolsSliders);
    m_toolsMenu->insertSeparator();
    m_toolsMenu->insertItem(QPixmap(dir + "/panic.xpm"),
                            "&Panic!", this, SLOT(slotToolsPanic()),
                            0, KVCMenuToolsPanic);


    //
    // Foreground menu
    //
    QPopupMenu* fgMenu = new QPopupMenu();
    fgMenu->insertItem(QPixmap(dir + QString("/color.xpm")),
                       "&Color...", this, SLOT(slotForegroundColor()),
                       0, KVCMenuForegroundColor);
    fgMenu->insertItem(QPixmap(dir + QString("/rename.xpm")),
                       "&Font...", this, SLOT(slotForegroundFont()),
                       0, KVCMenuForegroundFont);
    fgMenu->insertItem(QPixmap(dir + QString("/fileclose.xpm")),
                       "&Default", this, SLOT(slotForegroundNone()),
                       0, KVCMenuForegroundNone);

    //
    // Background Menu
    //
    QPopupMenu* bgMenu = new QPopupMenu();
    bgMenu->insertItem(QPixmap(dir + QString("/color.xpm")),
                       "&Color...", this, SLOT(slotBackgroundColor()),
                       0, KVCMenuBackgroundColor);
    bgMenu->insertItem(QPixmap(dir + QString("/image.xpm")),
                       "&Image...", this, SLOT(slotBackgroundImage()),
                       0, KVCMenuBackgroundPixmap);
    bgMenu->insertItem(QPixmap(dir + QString("/fileclose.xpm")),
                       "&Default", this, SLOT(slotBackgroundNone()),
                       0, KVCMenuBackgroundNone);
    bgMenu->insertSeparator();
    bgMenu->insertItem(QPixmap(dir + QString("/frame.xpm")),
                       "Toggle &Frame", this, SLOT(slotBackgroundFrame()),
                       0, KVCMenuBackgroundFrame);

    //
    // Stacking order menu
    //
    QPopupMenu* stackMenu = new QPopupMenu();
    stackMenu->insertItem(QPixmap(dir + QString("/up.xpm")),
                          "&Raise", this, SLOT(slotStackingRaise()),
                          0, KVCMenuStackingRaise);
    stackMenu->insertItem(QPixmap(dir + QString("/down.xpm")),
                          "&Lower", this, SLOT(slotStackingLower()),
                          0, KVCMenuStackingLower);

    //
    // Edit menu
    //
    m_editMenu = new QPopupMenu();
    m_editMenu->insertItem(QPixmap(dir + "/editcut.xpm"),
                           "Cut", this, SLOT(slotEditCut()),
                           0, KVCMenuEditCut);

    m_editMenu->insertItem(QPixmap(dir + "/editcopy.xpm"),
                           "Copy", this, SLOT(slotEditCopy()),
                           0, KVCMenuEditCopy);

    m_editMenu->insertItem(QPixmap(dir + "/editpaste.xpm"),
                           "Paste", this, SLOT(slotEditPaste()),
                           0, KVCMenuEditPaste);

    m_editMenu->insertItem(QPixmap(dir + "/remove.xpm"),
                           "Delete", this, SLOT(slotEditDelete()),
                           0, KVCMenuEditDelete);

    m_editMenu->insertSeparator();

    m_editMenu->insertItem(QPixmap(dir + "/settings.xpm"),
                           "&Properties...", this, SLOT(slotEditProperties()),
                           0, KVCMenuEditProperties);
    m_editMenu->insertItem(QPixmap(dir + QString("/rename.xpm")),
                           "&Rename...", this, SLOT(slotEditRename()),
                           0, KVCMenuEditRename);

    m_editMenu->setItemEnabled(KVCMenuEditCut, false);
    m_editMenu->setItemEnabled(KVCMenuEditCopy, false);
    m_editMenu->setItemEnabled(KVCMenuEditPaste, false);

    m_editMenu->insertSeparator();

    m_editMenu->insertItem("Foreground", fgMenu, KVCMenuForegroundMin);
    m_editMenu->insertItem("Background", bgMenu, KVCMenuBackgroundMin);
    m_editMenu->insertItem("Stacking Order", stackMenu, KVCMenuStackingMin);

    m_menuBar->insertItem("&Tools", m_toolsMenu);
    m_menuBar->insertItem("&Add", m_addMenu);
    m_menuBar->insertItem("&Edit", m_editMenu);
}
void 
ItemXML::contextMenu(QPopupMenu& _menu)
{
  _menu.insertItem("Set Name", this, SLOT(slotRename()));
  _menu.insertSeparator();
}
void
NotifySubscribe::contextMenu(QPopupMenu& _menu)
{
  _menu.insertItem("subscription change", this, SLOT(subscriptionChange()));
}
예제 #7
0
/*
  In the constructor, we just pass the standard parameters on to
  QWidget.

  The menu uses a single slot to simplify the process of adding
  more items to the options menu.
*/
ImageViewer::ImageViewer( QWidget *parent, const char *name, int wFlags )
    : QWidget( parent, name, wFlags ),
      conversion_flags( PreferDither ),
      helpmsg( 0 )
{
    pickx = -1;
    picky = -1;
    clickx = -1;
    clicky = -1;
    alloc_context = 0;

    menubar = new QMenuBar(this);
    menubar->setSeparator( QMenuBar::InWindowsStyle );

    QStrList fmt = QImage::outputFormats();
    saveimage = new QPopupMenu( menubar );
    savepixmap = new QPopupMenu( menubar );
    for (const char* f = fmt.first(); f; f = fmt.next()) {
	saveimage->insertItem( f );
	savepixmap->insertItem( f );
    }
    connect( saveimage, SIGNAL(activated(int)), this, SLOT(saveImage(int)) );
    connect( savepixmap, SIGNAL(activated(int)), this, SLOT(savePixmap(int)) );

    file = new QPopupMenu( menubar );
    menubar->insertItem( "&File", file );
    file->insertItem( "&New window", this,  SLOT(newWindow()), CTRL+Key_N );
    file->insertItem( "&Open...", this,  SLOT(openFile()), CTRL+Key_O );
    si = file->insertItem( "Save image", saveimage );
    sp = file->insertItem( "Save pixmap", savepixmap );
    file->insertSeparator();
    file->insertItem( "E&xit", qApp,  SLOT(quit()), CTRL+Key_Q );

    edit =  new QPopupMenu( menubar );
    menubar->insertItem( "&Edit", edit );
    edit->insertItem("&Copy", this, SLOT(copy()), CTRL+Key_C);
    edit->insertItem("&Paste", this, SLOT(paste()), CTRL+Key_V);
    edit->insertSeparator();
    edit->insertItem("&Horizontal flip", this, SLOT(hFlip()), ALT+Key_H);
    edit->insertItem("&Vertical flip", this, SLOT(vFlip()), ALT+Key_V);
    edit->insertItem("&Rotate 180", this, SLOT(rot180()), ALT+Key_R);
    edit->insertSeparator();
    edit->insertItem("&Text...", this, SLOT(editText()));
    edit->insertSeparator();
    t1 = edit->insertItem( "Convert to &1 bit", this, SLOT(to1Bit()) );
    t8 = edit->insertItem( "Convert to &8 bit", this, SLOT(to8Bit()) );
    t32 = edit->insertItem( "Convert to &32 bit", this, SLOT(to32Bit()) );

    options =  new QPopupMenu( menubar );
    menubar->insertItem( "&Options", options );
    ac = options->insertItem( "AutoColor" );
    co = options->insertItem( "ColorOnly" );
    mo = options->insertItem( "MonoOnly" );
    options->insertSeparator();
    fd = options->insertItem( "DiffuseDither" );
    bd = options->insertItem( "OrderedDither" );
    td = options->insertItem( "ThresholdDither" );
    options->insertSeparator();
    ta = options->insertItem( "ThresholdAlphaDither" );
    ba = options->insertItem( "OrderedAlphaDither" );
    fa = options->insertItem( "DiffuseAlphaDither" );
    options->insertSeparator();
    ad = options->insertItem( "PreferDither" );
    dd = options->insertItem( "AvoidDither" );
    options->insertSeparator();
    ss = options->insertItem( "Smooth scaling" );
    cc = options->insertItem( "Use color context" );
    if ( QApplication::colorSpec() == QApplication::ManyColor )
	options->setItemEnabled( cc, FALSE );
    options->setCheckable( TRUE );
    setMenuItemFlags();

    menubar->insertSeparator();

    QPopupMenu* help = new QPopupMenu( menubar );
    menubar->insertItem( "&Help", help );
    help->insertItem( "Help!", this, SLOT(giveHelp()), CTRL+Key_H );

    connect( options, SIGNAL(activated(int)), this, SLOT(doOption(int)) );

    status = new QLabel(this);
    status->setFrameStyle( QFrame::WinPanel | QFrame::Sunken );
    status->setFixedHeight( fontMetrics().height() + 4 );

    setMouseTracking( TRUE );
}
MyWidget::MyWidget( EventChannel_ptr _ec, 
		    const std::string& _context,
		    QWidget *parent, const char *name ) :
  QWidget( parent, name ),
  supplier(_ec, _context),
  context( _context ) 
{
  QBoxLayout *topLayout = new QHBoxLayout(this, 5);

  // the menu
  QPopupMenu *fileMenu = new QPopupMenu( this );
  fileMenu->insertItem( "&Load", this, SLOT( load() ) );
  fileMenu->insertItem( "&Quit", qApp, SLOT( quit() ) );

  menuBar = new QMenuBar( this );
  menuBar->insertItem( "&File", fileMenu );    

  // ... add to layout
  topLayout->setMenuBar(menuBar);

  // the widgets
  playButton = new QPushButton( "Play", this, "play" );
  playButton->setMinimumSize(90, 30);
  stopButton = new QPushButton( "Stop", this, "stop" );
  stopButton->setMinimumSize(90, 30);
  pauseButton = new QPushButton( "Pause", this, "pause" );
  pauseButton->setMinimumSize(90, 30);

  nextButton = new QPushButton( "Next", this, "next" );
  nextButton->setMinimumSize(90, 30);
  prevButton = new QPushButton( "Prev", this, "prev" );
  prevButton->setMinimumSize(90, 30);
  
  secLabel = new QLCDNumber( 3, this, "sec" );
  centiSecLabel = new QLCDNumber( 2, this, "sec" );
  
  timeSlider = new QSlider( Horizontal, this, "time" );
  timeSlider->setRange(0, 1000);
  timeSlider->setValue(0);

  speedDial = new QDial( 10, 200, 10, 10, this, "speed" );
  speedDial->setWrapping(false);

  // ... add to the layout 
  QBoxLayout *layout1 = new QVBoxLayout(topLayout, 5);
  QGridLayout *layout2 = new QGridLayout(layout1, 2, 3, 5);

  layout2->addWidget(playButton, 0, 0);
  layout2->addWidget(stopButton, 0, 1);
  layout2->addWidget(pauseButton, 0, 2);
  layout2->addWidget(prevButton, 1, 0);
  QBoxLayout *layout3 = new QHBoxLayout(layout2);
  layout2->addWidget(nextButton, 1, 2);

  layout3->addWidget(secLabel);
  layout3->addWidget(centiSecLabel);

  layout1->addSpacing(10);
  layout1->addWidget(timeSlider);
  topLayout->addWidget(speedDial);

  // signals n slots
  connect( timeSlider, SIGNAL( valueChanged(int) ),
	   (MyWidget *)this, SLOT( changed(int) ) );
  connect( timeSlider, SIGNAL( sliderPressed() ),
	   (MyWidget *)this, SLOT( beginAction() ) );
  connect( timeSlider, SIGNAL( sliderReleased() ),
	   (MyWidget *)this, SLOT( endAction() ) );
  connect( timeSlider, SIGNAL( sliderMoved( int ) ),
	   (MyWidget *)this, SLOT( timeAction( int ) ) );

  connect( &timer, SIGNAL( timeout() ),
	   (MyWidget *)this, SLOT( step() ) );

  connect( playButton, SIGNAL( clicked() ),
	   (MyWidget *)this, SLOT( play() ) );
  connect( stopButton, SIGNAL( clicked() ),
	   (MyWidget *)this, SLOT( stop() ) );
  connect( pauseButton, SIGNAL( clicked() ),
	   (MyWidget *)this, SLOT( pause() ) );
  connect( prevButton, SIGNAL( clicked() ),
	   (MyWidget *)this, SLOT( prev() ) );
  connect( nextButton, SIGNAL( clicked() ),
	   (MyWidget *)this, SLOT( next() ) );

  connect( speedDial, SIGNAL( valueChanged( int ) ),
	   (MyWidget *)this, SLOT( speed( int ) ) );
  connect( speedDial, SIGNAL( dialPressed() ),
	   (MyWidget *)this, SLOT( beginAction() ) );
  connect( speedDial, SIGNAL( dialReleased() ),
	   (MyWidget *)this, SLOT( endAction() ) );

  action = false;
  timeSpeed = 10;
}
예제 #9
0
// constructor
MyWindow::MyWindow(int w, int h) : 
  red_active(false),
  red_set(*(new Polygon_set)),
  blue_set(*(new Polygon_set)),
  res_set(*(new Polygon_set))										  
{
  widget = new CGAL::Qt_widget(this); //Constructs a widget which is a child of this window


  /* Sets the central widget for this main window to w.
   * The central widget is surrounded by the left, top, right and bottom dock areas.
   * The menu bar is above the top dock area
   */
  setCentralWidget(widget);

  file_name= QString::null;

  //create a timer for checking if somthing changed
  QTimer *timer = new QTimer( this ); // constructs a timer whose parent is this window

  connect( timer, SIGNAL(timeout()),
           this, SLOT(timer_done()) );  // connects the timer to the window
  timer->start( 200, FALSE ); // Starts the timer with a msec milliseconds timeout

  // file menu
  QPopupMenu * file = new QPopupMenu( this );
  menuBar()->insertItem( "&File", file );
  file->insertItem("&New", this, SLOT(new_instance()), CTRL+Key_N);
  file->insertItem("New &Window", this, SLOT(new_window()), CTRL+Key_W);
  file->insertSeparator();
  file->insertItem("&Open Linear Polygon file", this, SLOT(open_linear_polygon_file()),CTRL+Key_O);
  file->insertItem("&Open DXF file", this, SLOT(open_dxf_file()),CTRL+Key_D);
  file->insertSeparator();
  //file->insertItem("&Save",this ,SLOT(save_file()),CTRL+Key_S);
  //file->insertItem("&Save as",this ,SLOT(save_file_as()));
  file->insertSeparator();
  file->insertItem("Print", widget, SLOT(print_to_ps()), CTRL+Key_P);
  file->insertSeparator();
  file->insertItem( "&Close", this, SLOT(close()), CTRL+Key_X );
  file->insertItem( "&Quit", qApp, SLOT( closeAllWindows() ), CTRL+Key_Q );

  // help menu
  QPopupMenu * help = new QPopupMenu( this );
  menuBar()->insertItem( "&Help", help );
  help->insertItem("How To", this, SLOT(howto()), Key_F1);
  help->insertSeparator();
  help->insertItem("&About", this, SLOT(about()), CTRL+Key_A );
  help->insertItem("About &Qt", this, SLOT(aboutQt()) );

  //the standard toolbar
  stoolbar = new CGAL::Qt_widget_standard_toolbar (widget, this, "ST");

  radiotoolbar = new QToolBar(this, "polygon type");
  blue_pgn = new QRadioButton ("Blue", radiotoolbar);
  blue_pgn->toggle();
  red_pgn = new QRadioButton("Red", radiotoolbar);
  radio_group = new QVButtonGroup(this,"Radios");
  radio_group->insert(blue_pgn);
  radio_group->insert(red_pgn);
  radio_group->setRadioButtonExclusive(true);


  connect(blue_pgn, SIGNAL(toggled (bool)),
	  this, SLOT(radio_selected()));
  connect(red_pgn, SIGNAL(toggled (bool)),
	  this, SLOT(radio_selected()));


  //layers
  //widget->attach(&testlayer);

  //the new tools toolbar
  newtoolbar = new Tools_toolbar(widget, this);

  // voronoi toolbar
  bops_toolbar = new QToolBar(this, "Boolean operations");

  QIconSet set0(QPixmap( (const char**)intersection_xpm ),
		QPixmap( (const char**)intersection_xpm ));

  intersection_but = new QToolButton(bops_toolbar, "Boolean operations");
  intersection_but->setAutoRaise(TRUE);

  intersection_but->setIconSet(set0);
  intersection_but->setTextLabel("Intersection ");
  connect(intersection_but,SIGNAL(pressed()),
	  this, SLOT(perform_intersection()));

  QIconSet set1(QPixmap( (const char**)union_xpm ),
		QPixmap( (const char**)union_xpm ));

  bops_toolbar->addSeparator();
  union_but = new QToolButton(bops_toolbar, "Boolean operations");
  union_but->setAutoRaise(TRUE);

  union_but->setIconSet(set1);
  union_but->setTextLabel("Union ");
  connect(union_but,SIGNAL(pressed()),
	  this, SLOT(perform_union()));

  QIconSet set2(QPixmap( (const char**)diff_PQ_xpm ),
		QPixmap( (const char**)diff_PQ_xpm ));

  bops_toolbar->addSeparator();
  diff_but2 = new QToolButton(bops_toolbar, "Boolean operations");
  diff_but2->setAutoRaise(TRUE);

  diff_but2->setIconSet(set2);
  diff_but2->setTextLabel("Difference between Blue and Red");
  connect(diff_but2, SIGNAL(pressed()),
	  this, SLOT(perform_diff2()));

  QIconSet set3(QPixmap( (const char**)diff_QP_xpm ),
		QPixmap( (const char**)diff_QP_xpm ));

  bops_toolbar->addSeparator();
  diff_but = new QToolButton(bops_toolbar, "Boolean operations");
  diff_but->setAutoRaise(TRUE);

  diff_but->setIconSet(set3);
  diff_but->setTextLabel("Difference between Red and Blue");
  connect(diff_but, SIGNAL(pressed()),
	  this, SLOT(perform_diff()));

  QIconSet set4(QPixmap( (const char**)symm_diff_xpm ),
		QPixmap( (const char**)symm_diff_xpm ));
  bops_toolbar->addSeparator();

  symm_diff_but = new QToolButton(bops_toolbar, "Boolean operations");
  symm_diff_but->setAutoRaise(TRUE);

  symm_diff_but->setIconSet(set4);
  symm_diff_but->setTextLabel("Symmetric Difference ");
  connect(symm_diff_but, SIGNAL(pressed()),
	  this, SLOT(perform_symm_diff()));

  QIconSet set12(QPixmap( (const char**)mink_sum_xpm ),
		 QPixmap( (const char**)mink_sum_xpm ));
  bops_toolbar->addSeparator();
  mink_sum_but = new QToolButton(bops_toolbar, "Boolean operations");
  mink_sum_but->setAutoRaise(TRUE);
  mink_sum_but->setIconSet(set12);
  mink_sum_but->setTextLabel("Minkowski Sum ");
  connect(mink_sum_but, SIGNAL(pressed()),
	  this, SLOT(perform_mink_sum()));

  QIconSet set5(QPixmap( (const char**)comp_P_xpm ),
		QPixmap( (const char**)comp_P_xpm ));
  bops_toolbar->addSeparator();

  blue_complement_but = new QToolButton(bops_toolbar, "Boolean operations");
  blue_complement_but->setAutoRaise(TRUE);

  blue_complement_but->setIconSet(set5);
  blue_complement_but->setTextLabel("Blue Complement ");
  connect(blue_complement_but, SIGNAL(pressed()),
	  this, SLOT(perform_blue_complement()));

  QIconSet set6(QPixmap( (const char**)comp_Q_xpm ),
		QPixmap( (const char**)comp_Q_xpm ));
  bops_toolbar->addSeparator();

  red_complement_but = new QToolButton(bops_toolbar, "Boolean operations");
  red_complement_but->setAutoRaise(TRUE);

  red_complement_but->setIconSet(set6);
  red_complement_but->setTextLabel("Red Complement ");
  connect(red_complement_but, SIGNAL(pressed()),
	  this, SLOT(perform_red_complement()));


  QIconSet set7(QPixmap( (const char**)make_P_xpm ),
		QPixmap( (const char**)make_P_xpm ));
  bops_toolbar->addSeparator();
  make_res_blue_but = new QToolButton(bops_toolbar, "Boolean operations");
  make_res_blue_but->setAutoRaise(TRUE);


  make_res_blue_but->setIconSet(set7);
  make_res_blue_but->setTextLabel("Make Result Blue");
  connect(make_res_blue_but,SIGNAL(pressed()),
	  this, SLOT(make_res_blue()));

  QIconSet set8(QPixmap( (const char**)make_Q_xpm ),
		QPixmap( (const char**)make_Q_xpm ));
  bops_toolbar->addSeparator();
  make_res_red_but = new QToolButton(bops_toolbar, "Boolean operations");
  make_res_red_but->setAutoRaise(TRUE);


  make_res_red_but->setIconSet(set8);
  make_res_red_but->setTextLabel("Make Result Red");
  connect(make_res_red_but,SIGNAL(pressed()),
	  this, SLOT(make_res_red()));

  QIconSet set9(QPixmap( (const char**)refresh_xpm ),
		QPixmap( (const char**)refresh_xpm ));
  bops_toolbar->addSeparator();

  refresh_but = new QToolButton(bops_toolbar, "Boolean operations");
  refresh_but->setAutoRaise(TRUE);

  refresh_but->setIconSet(set9);
  refresh_but->setTextLabel("Refresh ");
  connect(refresh_but,SIGNAL(pressed()),
	  this, SLOT(refresh()));

  QIconSet set10(QPixmap( (const char**)del_P_xpm ),
		 QPixmap( (const char**)del_P_xpm ));
  bops_toolbar->addSeparator();

  delete_blue_but = new QToolButton(bops_toolbar, "Boolean operations");
  delete_blue_but->setAutoRaise(TRUE);

  delete_blue_but->setIconSet(set10);
  delete_blue_but->setTextLabel("Delete Blue Polygons");
  connect(delete_blue_but,SIGNAL(pressed()),
	  this, SLOT(delete_blue_polygons()));


  QIconSet set11(QPixmap( (const char**)del_Q_xpm ),
		 QPixmap( (const char**)del_Q_xpm ));
  bops_toolbar->addSeparator();

  delete_red_but = new QToolButton(bops_toolbar, "Boolean operations");
  delete_red_but->setAutoRaise(TRUE);

  delete_red_but->setIconSet(set11);
  delete_red_but->setTextLabel("Delete Red Polygons");
  connect(delete_red_but,SIGNAL(pressed()),
	  this, SLOT(delete_red_polygons()));




  *widget << CGAL::LineWidth(2) << CGAL::BackgroundColor (CGAL::BLACK);

  resize(w,h);
  widget->set_window(-1, 1, -1, 1);
  widget->setMouseTracking(TRUE);

  //connect the widget to the main function that receives the objects
  connect(widget, SIGNAL(new_cgal_object(CGAL::Object)),
	  this, SLOT(get_new_object(CGAL::Object)));

  //application flag stuff
  old_state = 0;
  current_state = 1;
  red_active = false;
  red_set.clear();
  blue_set.clear();
  res_set.clear();
}
예제 #10
0
FLHelpWindow::FLHelpWindow(const QString &home_,
                           const QString &_path,
                           QWidget *parent,
                           const char *name) :
  QMainWindow(parent, name, WDestructiveClose),
  pathCombo(0), selectedURL()
{
  readHistory();
  readBookmarks();

  browser = new QTextBrowser(this);

  browser->mimeSourceFactory() ->setFilePath(_path);
  browser->setFrameStyle(QFrame::Panel | QFrame::Sunken);
  connect(browser, SIGNAL(textChanged()), this, SLOT(textChanged()));

  setCentralWidget(browser);

  if (!home_.isEmpty())
    browser->setSource(home_);

  connect(browser, SIGNAL(highlighted(const QString &)), statusBar(),
          SLOT(message(const QString &)));

  resize(640, 700);

  QPopupMenu *file = new QPopupMenu(this);

  file->insertItem(tr("&Imprimir"), this, SLOT(print()), CTRL + Key_I);
  file->insertSeparator();
  file->insertItem(tr("&Cerrar"), this, SLOT(close()), Key_Escape);

  // The same three icons are used twice each.
  QIconSet icon_back(QPixmap::fromMimeSource("previous.png"));
  QIconSet icon_forward(QPixmap::fromMimeSource("next.png"));
  QIconSet icon_home(QPixmap::fromMimeSource("home.png"));

  QPopupMenu *go = new QPopupMenu(this);

  backwardId =
    go->insertItem(icon_back, tr("&Atrás"), browser, SLOT(backward()),
                   CTRL + Key_Left);
  forwardId =
    go->insertItem(icon_forward, tr("&Adelante"), browser,
                   SLOT(forward()), CTRL + Key_Right);
  go->insertItem(icon_home, tr("&Inicio"), browser, SLOT(home()));

  QPopupMenu *help = new QPopupMenu(this);

  help->insertItem(tr("&Acerca ..."), this, SLOT(about()));
  help->insertItem(tr("Acerca de &Qt ..."), this, SLOT(aboutQt()));

  hist = new QPopupMenu(this);
  QStringList::Iterator it = history.begin();
  for (; it != history.end(); ++it)
    mHistory[ hist->insertItem(*it)] = *it;
  connect(hist, SIGNAL(activated(int)), this, SLOT(histChosen(int)));

  bookm = new QPopupMenu(this);
  bookm->insertItem(tr("Agregar Favorito"), this, SLOT(addBookmark()));
  bookm->insertSeparator();

  QStringList::Iterator it2 = bookmarks.begin();
  for (; it2 != bookmarks.end(); ++it2)
    mBookmarks[ bookm->insertItem(*it2)] = *it2;
  connect(bookm, SIGNAL(activated(int)), this, SLOT(bookmChosen(int)));

  menuBar() ->insertItem(tr("&Archivo"), file);
  menuBar() ->insertItem(tr("&Ir"), go);
  menuBar() ->insertItem(tr("Historial"), hist);
  menuBar() ->insertItem(tr("Favoritos"), bookm);
  menuBar() ->insertSeparator();
  menuBar() ->insertItem(tr("&Ayuda"), help);

  menuBar() ->setItemEnabled(forwardId, FALSE);
  menuBar() ->setItemEnabled(backwardId, FALSE);
  connect(browser, SIGNAL(backwardAvailable(bool)), this,
          SLOT(setBackwardAvailable(bool)));
  connect(browser, SIGNAL(forwardAvailable(bool)), this,
          SLOT(setForwardAvailable(bool)));


  QToolBar *toolbar = new QToolBar(this);

  addToolBar(toolbar, "Toolbar");
  QToolButton *button;

  button =
    new QToolButton(icon_back, tr("Atrás"), "", browser, SLOT(backward()),
                    toolbar);
  connect(browser, SIGNAL(backwardAvailable(bool)), button,
          SLOT(setEnabled(bool)));
  button->setEnabled(FALSE);
  button =
    new QToolButton(icon_forward, tr("Adelante"), "", browser,
                    SLOT(forward()), toolbar);
  connect(browser, SIGNAL(forwardAvailable(bool)), button,
          SLOT(setEnabled(bool)));
  button->setEnabled(FALSE);
  button =
    new QToolButton(icon_home, tr("Inicio"), "", browser, SLOT(home()),
                    toolbar);

  toolbar->addSeparator();

  pathCombo = new QComboBox(TRUE, toolbar);
  connect(pathCombo, SIGNAL(activated(const QString &)), this,
          SLOT(pathSelected(const QString &)));
  toolbar->setStretchableWidget(pathCombo);
  setRightJustification(TRUE);
  setDockEnabled(DockLeft, FALSE);
  setDockEnabled(DockRight, FALSE);

  pathCombo->insertItem(home_);
  browser->setFocus();
}
예제 #11
0
kernelinfo::kernelinfo()
    : QMainWindow( 0, "kernelinfo", WDestructiveClose )
{
    printer = new QPrinter;
    QPixmap openIcon, saveIcon, printIcon;

    QToolBar * fileTools = new QToolBar( this, "file operations" );
    fileTools->setLabel( tr("File Operations") );

    openIcon = QPixmap( fileopen );
    QToolButton * fileOpen
	= new QToolButton( openIcon, tr("Open File"), QString::null,
			   this, SLOT(choose()), fileTools, "open file" );

    saveIcon = QPixmap( filesave );
    QToolButton * fileSave
	= new QToolButton( saveIcon, tr("Save File"), QString::null,
			   this, SLOT(save()), fileTools, "save file" );

    printIcon = QPixmap( fileprint );
    QToolButton * filePrint
	= new QToolButton( printIcon, tr("Print File"), QString::null,
			   this, SLOT(print()), fileTools, "print file" );


    (void)QWhatsThis::whatsThisButton( fileTools );

    QString fileOpenText = tr("<p><img source=\"fileopen\"> "
	         "Click this button to open a <em>new file</em>. <br>"
                 "You can also select the <b>Open</b> command "
                 "from the <b>File</b> menu.</p>");

    QWhatsThis::add( fileOpen, fileOpenText );

    QMimeSourceFactory::defaultFactory()->setPixmap( "fileopen", openIcon );

    QString fileSaveText = tr("<p>Click this button to save the file you "
                 "are editing. You will be prompted for a file name.\n"
                 "You can also select the <b>Save</b> command "
                 "from the <b>File</b> menu.</p>");

    QWhatsThis::add( fileSave, fileSaveText );

    QString filePrintText = tr("Click this button to print the file you "
                 "are editing.\n You can also select the Print "
                 "command from the File menu.");

    QWhatsThis::add( filePrint, filePrintText );


    QPopupMenu * file = new QPopupMenu( this );
    menuBar()->insertItem( tr("&File"), file );


    file->insertItem( tr("&New"), this, SLOT(newDoc()), CTRL+Key_N );

    int id;
    id = file->insertItem( openIcon, tr("&Open..."),
			   this, SLOT(choose()), CTRL+Key_O );
    file->setWhatsThis( id, fileOpenText );

    id = file->insertItem( saveIcon, tr("&Save"),
			   this, SLOT(save()), CTRL+Key_S );
    file->setWhatsThis( id, fileSaveText );

    id = file->insertItem( tr("Save &As..."), this, SLOT(saveAs()) );
    file->setWhatsThis( id, fileSaveText );

    file->insertSeparator();

    id = file->insertItem( printIcon, tr("&Print..."),
			   this, SLOT(print()), CTRL+Key_P );
    file->setWhatsThis( id, filePrintText );

    file->insertSeparator();

    file->insertItem( tr("&Close"), this, SLOT(close()), CTRL+Key_W );

    file->insertItem( tr("&Quit"), qApp, SLOT( closeAllWindows() ), CTRL+Key_Q );

    menuBar()->insertSeparator();

    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()) );
    help->insertSeparator();
    help->insertItem( tr("What's &This"), this, SLOT(whatsThis()), SHIFT+Key_F1 );

    e = new QTextEdit( this, "editor" );
    e->setFocus();
    setCentralWidget( e );
    statusBar()->message( tr("Ready"), 2000 );

    resize( 450, 600 );
}
예제 #12
0
int HexWidget::initMenu() {

    windowList.append(this);

    CurrentFile=new HexFile(this);
    unsaved( false );
    connect(CurrentFile, SIGNAL( unsaved(bool) ), SLOT( unsaved(bool) ));

    QPopupMenu *file = new QPopupMenu;
    file->insertItem( i18n("&New Window..."), ID_FILE_NEWWIN);
    file->insertSeparator();
    file->insertItem(  i18n("&Open..."), ID_FILE_OPEN );
    file->insertItem(  i18n("&Save"), ID_FILE_SAVE);
    file->insertItem(  i18n("Save &As..."), ID_FILE_SAVEAS);
    file->insertItem(  i18n("&Close"), ID_FILE_CLOSE);
    file->insertSeparator();
    file->insertItem(  i18n("&Quit"), ID_FILE_QUIT);
    
    QPopupMenu *edit = new QPopupMenu;
    edit->insertItem( i18n("&Copy"), ID_EDIT_COPY);
    edit->insertItem( i18n("&Paste"), ID_EDIT_PASTE);
    edit->insertItem( i18n("C&ut"), ID_EDIT_CUT);

    QPopupMenu *view = new QPopupMenu;
    view->insertItem( i18n("&Toggle Toolbar"), ID_VIEW_TOOLBAR);
    //  view->insertItem( "Toggle Statusbar", ID_VIEW_STATUSBAR);
    
    QPopupMenu *help = kapp->getHelpMenu(true, QString(i18n("Hex Editor")) 
					 + " " + KHEXDIT_VERSION 
					 + i18n("\n\nby Stephan Kulow") 
					 + " ([email protected])");

    connect (file, SIGNAL (activated (int)), SLOT (menuCallback (int)));
    connect (edit, SIGNAL (activated (int)), SLOT (menuCallback (int)));
    connect (help, SIGNAL (activated (int)), SLOT (menuCallback (int)));
    connect (view, SIGNAL (activated (int)), SLOT (menuCallback (int)));
    
    menu = new KMenuBar( this );
    CHECK_PTR( menu );
    menu->insertItem( i18n("&File"), file );
    menu->insertItem( i18n("&Edit"), edit);
    menu->insertItem( i18n("&View"), view );
    menu->insertSeparator();
    menu->insertItem( i18n("&Help"), help );
    menu->show();
    setMenu(menu);
    
    KIconLoader *loader = kapp->getIconLoader();
    toolbar = new KToolBar(this);
    
    toolbar->insertButton(loader->loadIcon("filenew.xpm"),
			  ID_FILE_NEWWIN, true, 
			  i18n("New Window"));
    toolbar->insertButton(loader->loadIcon("fileopen.xpm"),ID_FILE_OPEN, true, 
			  i18n("Open a file"));
    toolbar->insertButton(loader->loadIcon("filefloppy.xpm"), ID_FILE_SAVE, 
			  true, i18n("Save the file"));
    toolbar->insertSeparator();
    toolbar->insertButton(loader->loadIcon("editcut.xpm"),ID_EDIT_CUT, false, 
			  i18n("Not implemented"));
    toolbar->insertButton(loader->loadIcon("editcopy.xpm"),ID_EDIT_COPY, false,
			  i18n("Not implemented"));
    toolbar->insertButton(loader->loadIcon("editpaste.xpm"),ID_EDIT_PASTE, 
			  false, i18n("Not implemented"));
    toolbar->insertSeparator();
    toolbar->insertButton(loader->loadIcon("fileprint.xpm"),ID_FILE_PRINT, 
			  false, i18n("Not implemented"));
    
    addToolBar(toolbar);
    toolbar->setBarPos(KToolBar::Top);
    toolbar->show();
    connect(toolbar, SIGNAL(clicked(int)), SLOT(menuCallback(int)));
    
    // KStatusBar *stat = new KStatusBar(this);
    // stat->show();
    // setStatusBar(stat);
    
    kfm = 0L;
    setView(CurrentFile);
    dropZone = new KDNDDropZone( this , DndURL);
    connect( dropZone, SIGNAL( dropAction( KDNDDropZone *) ), 
	     SLOT( slotDropEvent( KDNDDropZone *) ) );
    
    show();
    return 0;
}
예제 #13
0
/*! MyWindow constructor
 * \param w - window width
 * \param h - window hight
 */
MyWindow::MyWindow(int w, int h) : num_of_colors(18)
{
  myBar = new QTabWidget(this);
  setCentralWidget(myBar);
  m_width = w;
  m_height = h;
  tab_number = 0;
  number_of_tabs = 0;
  testlayer = new Qt_layer( myBar );
  colors_flag = true;
  statusBar();

  m_scailing_factor = 2;

  // Traits Group
  QActionGroup *traitsGroup = new QActionGroup( this ); // Connected later
  traitsGroup->setExclusive( TRUE );

  /*setSegmentTraits = new QAction("Segment Traits",
                                 QPixmap( (const char**)line_xpm ),
                                 "&Segment Traits", 0 ,traitsGroup,
                                 "Segment Traits" );
  setSegmentTraits->setToggleAction( TRUE );

  setPolylineTraits = new QAction("Polyline Traits",
                                  QPixmap( (const char**)polyline_xpm ),
                                  "&Polyline Traits", 0 , traitsGroup,
                                  "Polyline Traits" );
  setPolylineTraits->setToggleAction( TRUE );

#ifdef CGAL_USE_CORE
  setConicTraits = new QAction("Conic Traits",
                               QPixmap( (const char**)conic_xpm ),
                               "&Conic Traits", 0 , traitsGroup,
                               "Conic Traits" );
  setConicTraits->setToggleAction( TRUE );
#endif
*/
  // Snap Mode Group

  setSnapMode = new QAction("Snap Mode", QPixmap( (const char**)snapvertex_xpm ),
                            "&Snap Mode", 0 , this, "Snap Mode" );
  setSnapMode->setToggleAction( TRUE );

  setGridSnapMode = new QAction("Grid Snap Mode",
                                QPixmap( (const char**)snapgrid_xpm ),
                                "&Grid Snap Mode", 0 , this,
                                "Grid Snap Mode" );
  setGridSnapMode->setToggleAction( TRUE );

  // insert - delete - point_location Mode Group
  QActionGroup *modeGroup = new QActionGroup( this ); // Connected later
  modeGroup->setExclusive( TRUE );

  insertMode = new QAction("Insert", QPixmap( (const char**)insert_xpm ),
                           "&Insert", 0 , modeGroup, "Insert" );
  insertMode->setToggleAction( TRUE );

  deleteMode = new QAction("Delete", QPixmap( (const char**)delete_xpm ),
                           "&Delete", 0 , modeGroup, "Delete" );
  deleteMode->setToggleAction( TRUE );

  pointLocationMode = new QAction("PointLocation",
                                  QPixmap( (const char**)pointlocation_xpm ),
                                  "&Point Location", 0 , modeGroup,
                                  "Point Location" );
  pointLocationMode->setToggleAction( TRUE );

  dragMode = new QAction("Drag", QPixmap( (const char**)hand_xpm ),
                         "&Drag", 0 , modeGroup, "Drag" );
  dragMode->setToggleAction( TRUE );

  // zoom in
  zoominBt = new QAction("Zoom in", QPixmap( (const char**)zoomin_xpm ),
                         "&Zoom in", 0 , this, "Zoom in" );
  // zoom out
  zoomoutBt = new QAction("Zoom out", QPixmap( (const char**)zoomout_xpm ),
                          "&Zoom out", 0 , this, "Zoom out" );

   // color dialog
  color_dialog_bt = new QAction("Choose color", QPixmap( (const char**)demo_colors_xpm ),
                         "&choose color", 0 , this, "choose color" );

	// Cartograms
  carto_new = new QAction("New instance", QPixmap( (const char**)carto_new_xpm ),
                         "&New instance", 0 , this, "New instance" );
  carto_weights = new QAction("Set weights", QPixmap( (const char**)carto_weights_xpm ),
                         "&Set weights", 0 , this, "Set weights" );
  carto_start = new QAction("Start Cartogram", QPixmap( (const char**)carto_start_xpm ),
                          "&Start Cartogram", 0 , this, "Start Cartogram" );
  carto_it = new QAction("Next step", QPixmap( (const char**)carto_nextIt_xpm ),
                         "&Next step", 0 , this, "Next step" );

/*
#ifdef CGAL_USE_CORE
  // Conic Type Group
  QActionGroup *conicTypeGroup = new QActionGroup( this ); // Connected later
  conicTypeGroup->setExclusive( TRUE );

  setCircle = new QAction("Circle",
                                 QPixmap( (const char**)demo_conic_circle_xpm ),
                                 "&Circle", 0 ,conicTypeGroup,
                                 "Circle" );
  setCircle->setToggleAction( TRUE );
  setSegment = new QAction("Segment",
                                 QPixmap( (const char**)demo_conic_segment_xpm ),
                                 "&Segment", 0 ,conicTypeGroup,
                                 "Segment" );
  setSegment->setToggleAction( TRUE );
  setEllipse = new QAction("Ellipse",
                                 QPixmap( (const char**)demo_conic_ellipse_xpm ),
                                 "&Ellipse", 0 ,conicTypeGroup,
                                 "Ellipse" );
  setEllipse->setToggleAction( TRUE );
  setParabola = new QAction("3 Points Arc",
                                 QPixmap( (const char**)demo_conic_3points_xpm ),
                                 "&3 Points Arc", 0 ,conicTypeGroup,
                                 "3 Points Arc" );
  setParabola->setToggleAction( TRUE );
  setHyperbola = new QAction("5 Points Arc",
                                 QPixmap( (const char**)demo_conic_5points_xpm ),
                                 "&5 Points Arc", 0 ,conicTypeGroup,
                                 "5 Points Arc" );
  setHyperbola->setToggleAction( TRUE );
#endif
*/
  //create a timer for checking if somthing changed
  QTimer *timer = new QTimer( this );
  connect( timer, SIGNAL(timeout()),
           this, SLOT(timer_done()) );
  timer->start( 200, FALSE );

  // file menu
  QPopupMenu * file = new QPopupMenu( this );
  menuBar()->insertItem( "&File", file );
  /*
  file->insertItem("&Open Segment File...", this, SLOT(fileOpenSegment()));
  file->insertItem("&Open Polyline File...", this, SLOT(fileOpenPolyline()));\
  file->insertItem("&Open Segment Arr File...", this, SLOT(fileOpenSegmentPm()));
  file->insertItem("&Open Polyline Arr File...", this, SLOT(fileOpenPolylinePm()));
  file->insertItem("&Open Conic Pm File", this, SLOT(fileOpenConicPm()));
  */
  file->insertItem("&Open Input File...", this, SLOT(fileOpenSegment()));
  file->insertItem("&Open Output File...", this, SLOT(fileOpenConic()));

  file->insertItem("&Save...", this, SLOT(fileSave()));
  file->insertItem("&Save As...", this, SLOT(fileSaveAs()));
  //file->insertItem("&Save to ps...", this, SLOT(fileSave_ps()));
  file->insertSeparator();
  file->insertItem("&Print...", this , SLOT(print()));
  file->insertSeparator();
  file->insertItem( "&Close", this, SLOT(close()), CTRL+Key_X );
  file->insertItem( "&Quit", qApp, SLOT( closeAllWindows() ), CTRL+Key_Q );
  menuBar()->insertSeparator();

  // tab menu
  QPopupMenu * tab = new QPopupMenu( this );
  menuBar()->insertItem( "&Tab", tab );
/*
  tab->insertItem("Add &Segment Tab", this, SLOT(add_segment_tab()));
  tab->insertItem("Add &Polyline Tab", this, SLOT(add_polyline_tab()));

#ifdef CGAL_USE_CORE
  tab->insertItem("Add &Conic Tab", this, SLOT(add_conic_tab()));
  tab->insertSeparator();
#endif
*/
  tab->insertItem("Remove &Tab", this, SLOT(remove_tab()));
  menuBar()->insertSeparator();

  // mode menu
  QPopupMenu * mode = new QPopupMenu( this );
  menuBar()->insertItem( "&Mode", mode );
  insertMode->addTo( mode );
  deleteMode->addTo( mode );
  pointLocationMode->addTo( mode );
  dragMode->addTo( mode );
  menuBar()->insertSeparator();

  // snap mode menu
  QPopupMenu * snap_mode = new QPopupMenu( this );
  menuBar()->insertItem( "&Snap mode", snap_mode );
  setSnapMode->addTo(snap_mode);
  setGridSnapMode->addTo(snap_mode);
  menuBar()->insertSeparator();

  // traits menu
  /*QPopupMenu * traits = new QPopupMenu( this );
  menuBar()->insertItem( "&Traits Type", traits );
  setSegmentTraits->addTo(traits);
  setPolylineTraits->addTo(traits);
#ifdef CGAL_USE_CORE
  setConicTraits->addTo(traits);
#endif
*/
  // options menu
  QPopupMenu * options = new QPopupMenu( this );
  menuBar()->insertItem( "&Options", options );
  options->insertSeparator();
  //options->insertItem("Overlay...", this, SLOT(overlay_pm()));
  options->insertSeparator();
  options->insertItem("Properties...", this, SLOT(properties()));
  options->insertSeparator();
  options->insertItem("Show Grid", this, SLOT(showGrid()));
  options->insertItem("Hide Grid", this, SLOT(hideGrid()));
  options->insertSeparator();
  //options->insertItem("Conic Type", this, SLOT(conicType()));
  //options->insertSeparator();
  options->insertItem("Unbounded Face Color...", this, SLOT(backGroundColor()));
  options->insertSeparator();
  options->insertItem("Edge Color...", this, SLOT(changeEdgeColor()));
  options->insertSeparator();
  options->insertItem("Vertex Color...", this, SLOT(changeVertexColor()));
  options->insertSeparator();
  /*options->insertItem("Point-Locaiton Strategy....", this ,
                                         SLOT(pointLocationStrategy()));
*/
  QToolBar *modeTools = new QToolBar( this, "mode operations" );
  modeTools->setLabel( "Mode Operations" );
  insertMode->addTo( modeTools );
  deleteMode->addTo( modeTools );
  pointLocationMode->addTo( modeTools );
  dragMode->addTo( modeTools );
  modeTools->addSeparator();

  QToolBar *snapModeTools = new QToolBar( this, "snapMode operations" );
  snapModeTools->setLabel( "Snap Mode Operations" );
  snapModeTools->addSeparator();
  setSnapMode->addTo( snapModeTools );
  setGridSnapMode->addTo( snapModeTools );
  snapModeTools->addSeparator();

  /*QToolBar *traitsTool = new QToolBar( this, "traits type" );
  traitsTool->setLabel( "Traits Type" );
  traitsTool->addSeparator();
  setSegmentTraits->addTo( traitsTool );
  setPolylineTraits->addTo( traitsTool );
#ifdef CGAL_USE_CORE
  setConicTraits->addTo( traitsTool );
#endif
  traitsTool->addSeparator();
*/
  QToolBar *zoomTool = new QToolBar( this, "zoom" );
  zoomTool->setLabel( "Zoom" );
  zoomTool->addSeparator();
  zoomoutBt->addTo( zoomTool );
  zoominBt->addTo( zoomTool );
  zoomTool->addSeparator();

  QToolBar *colorTool = new QToolBar( this, "color" );
  colorTool->addSeparator();
  colorTool->setLabel("Choose color");
  color_dialog_bt->addTo(colorTool);
  colorTool->addSeparator();

  QToolBar *cartoTool = new QToolBar( this, "cartograms" );
  cartoTool->addSeparator();
  cartoTool->setLabel("Cartograms");
  carto_new->addTo(cartoTool);
  carto_weights->addTo(cartoTool);
  carto_start->addTo(cartoTool);
  carto_it->addTo(cartoTool);
  cartoTool->addSeparator();

/*
#ifdef CGAL_USE_CORE
  conicTypeTool = new QToolBar( this, "conic type" );
  conicTypeTool->setLabel( "Conic Type" );
  conicTypeTool->addSeparator();
  setSegment->addTo( conicTypeTool );
  setCircle->addTo( conicTypeTool );
  setEllipse->addTo( conicTypeTool );
  setParabola->addTo( conicTypeTool );
  setHyperbola->addTo( conicTypeTool );
#endif
*/

  connect( zoomoutBt, SIGNAL( activated () ) ,
       this, SLOT( zoomout() ) );

  connect( zoominBt, SIGNAL( activated () ) ,
       this, SLOT( zoomin() ) );

  connect (color_dialog_bt , SIGNAL( activated()) ,
          this , SLOT(openColorDialog() ) );

  // connect mode group
  connect( modeGroup, SIGNAL( selected(QAction*) ),
           this, SLOT( updateMode(QAction*) ) );

  // connect Traits Group
/*  connect( traitsGroup, SIGNAL( selected(QAction*) ),
           this, SLOT( updateTraitsType(QAction*) ) );

#ifdef CGAL_USE_CORE
  // connect Conic Type Group
  connect( conicTypeGroup, SIGNAL( selected(QAction*) ),
           this, SLOT( updateConicType(QAction*) ) );
#endif
*/
  // connect Snap Mode

  connect( setSnapMode, SIGNAL( toggled( bool ) ) ,
           this, SLOT( updateSnapMode( bool ) ) );

  connect( setGridSnapMode, SIGNAL( toggled( bool ) ) ,
       this, SLOT( updateGridSnapMode( bool ) ) );

  // connect the change of current tab
  connect( myBar, SIGNAL( currentChanged(QWidget * )  ),
           this, SLOT( update() ) );

	// connect cartogram actions
	connect( carto_start, SIGNAL( activated () ) ,
       this, SLOT( cartogram_start() ) );

	connect( carto_weights, SIGNAL( activated () ) ,
       this, SLOT( cartogram_weights() ) );

	connect( carto_it, SIGNAL( activated () ) ,
       this, SLOT( print_all_weights()));

	connect( carto_new, SIGNAL( activated () ) ,
       this, SLOT( cartogram_balance() ) );

  colors = new QColor[num_of_colors];
  colors[0]  =  Qt::blue;
  colors[1]  =  Qt::gray;
  colors[2]  =  Qt::green;
  colors[3]  =  Qt::cyan;
  colors[4]  =  Qt::magenta;
  colors[5]  =  Qt::darkRed;
  colors[6]  =  Qt::darkGreen;
  colors[7]  =  Qt::darkBlue;
  colors[8]  =  Qt::darkMagenta;
  colors[9]  =  Qt::darkCyan;
  colors[10] =  Qt::yellow;
  colors[11] =  Qt::white;
  colors[12] =  Qt::darkGray;
  colors[13] =  Qt::gray;
  colors[14] =  Qt::red;
  colors[15] =  Qt::cyan;
  colors[16] =  Qt::darkYellow;
  colors[17] =  Qt::lightGray;

  //state flag
  old_state = 0;
  add_conic_tab();
  resize(m_width,m_height);
}
예제 #14
0
파일: vcwidget.cpp 프로젝트: speakman/qlc
QPopupMenu* VCWidget::createMenu()
{
	// Create edit menu here so that all submenus can be its children
	/* DO NOT set this as the menu's parent object. Otherwise deleting this
	   thru the menu will crash the whole program. */
	QPopupMenu* editMenu = new QPopupMenu(NULL);

	// Foreground menu
	QPopupMenu* fgMenu = new QPopupMenu(editMenu);
	fgMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/color.png")),
			   "&Color...", KVCMenuForegroundColor);
	fgMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/undo.png")),
			   "&Default", KVCMenuForegroundDefault);

	// Background menu
	QPopupMenu* bgMenu = new QPopupMenu(editMenu);
	bgMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/color.png")),
			   "&Color...", KVCMenuBackgroundColor);
	bgMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/image.png")),
			   "&Image...", KVCMenuBackgroundImage);
	bgMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/undo.png")),
			   "&Default", KVCMenuBackgroundDefault);

	// Font menu
	QPopupMenu* fontMenu = new QPopupMenu(editMenu);
	fontMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/fonts.png")),
			     "&Font...", KVCMenuFont);
	fontMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/undo.png")),
			   "&Default", KVCMenuFontDefault);

	// Frame menu
	QPopupMenu* frameMenu = new QPopupMenu(editMenu);
	frameMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/framesunken.png")),
			      "&Sunken", KVCMenuFrameSunken);
	frameMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/frameraised.png")),
			      "&Raised", KVCMenuFrameRaised);
	frameMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/framenone.png")),
			      "&None", KVCMenuFrameNone);

	// Stacking order menu
	QPopupMenu* stackMenu = new QPopupMenu(editMenu);
	stackMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/up.png")),
			      "Bring to &Front", KVCMenuStackingRaise);
	stackMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/down.png")),
			      "Send to &Back", KVCMenuStackingLower);

	// Edit menu
	editMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/editcut.png")),
			     "Cut", KVCMenuEditCut);
	editMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/editcopy.png")),
			     "Copy", KVCMenuEditCopy);
	editMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/editpaste.png")),
			     "Paste", KVCMenuEditPaste);
	editMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/editdelete.png")),
			     "Delete", KVCMenuEditDelete);

	editMenu->insertSeparator();

	editMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/configure.png")),
			       "&Properties...", KVCMenuEditProperties);
	editMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/editclear.png")),
			       "&Rename...", KVCMenuEditRename);

	editMenu->setItemEnabled(KVCMenuEditCut, false);
	editMenu->setItemEnabled(KVCMenuEditCopy, false);
	editMenu->setItemEnabled(KVCMenuEditPaste, false);

	editMenu->insertSeparator();

	editMenu->insertItem("Background", bgMenu);
	editMenu->insertItem("Foreground", fgMenu);
	editMenu->insertItem("Font", fontMenu);
	editMenu->insertItem("Frame", frameMenu);
	editMenu->insertItem("Stacking Order", stackMenu);

	connect(editMenu, SIGNAL(activated(int)),
		this, SLOT(slotMenuCallback(int)));
	connect(bgMenu, SIGNAL(activated(int)),
		this, SLOT(slotMenuCallback(int)));
	connect(fgMenu, SIGNAL(activated(int)),
		this, SLOT(slotMenuCallback(int)));
	connect(fontMenu, SIGNAL(activated(int)),
		this, SLOT(slotMenuCallback(int)));
	connect(frameMenu, SIGNAL(activated(int)),
		this, SLOT(slotMenuCallback(int)));
	connect(stackMenu, SIGNAL(activated(int)),
		this, SLOT(slotMenuCallback(int)));

	return editMenu;
}
예제 #15
0
void
ReportManager::showRMBMenu(QListViewItem* lvi, const QPoint& pos, int,
                           bool& errors, bool& showReportTab)
{
    ManagedReportInfo* mr = 0;
    for (std::list<ManagedReportInfo*>::const_iterator mri = reports.begin();
         mri != reports.end(); ++mri)
        if ((*mri)->getBrowserEntry() == lvi)
            mr = *mri;

    // Generate a context popup menu.
    QPopupMenu menu;
    if (mr)
    {
        menu.insertItem(i18n("&Show Report"), 1);
        menu.insertItem(i18n("&Generate Report"), 2);
        menu.insertItem(i18n("&Edit Report Definition"), 3);

        // The XML reports cannot be be viewed, so we disable the entry.
        if (strncmp(mr->getProjectReport()->getType(), "XML", 3) == 0)
            menu.setItemEnabled(1, false);

        // The interactive reports can not be generated, so we disable the entry.
        if (strncmp(mr->getProjectReport()->getType(), "Qt", 2) == 0)
            menu.setItemEnabled(2, false);

    }

    menu.insertItem(i18n("E&xpand All"), 4);
    menu.insertItem(i18n("S&hrink All"), 5);
    menu.insertItem(i18n("&Generate Sub-Reports"), 6);

    if (!lvi->firstChild())
    {
        menu.setItemEnabled(4, false);
        menu.setItemEnabled(5, false);
    }

    if (lvi == qtReports || !lvi->firstChild()
        || (mr && strncmp(mr->getProjectReport()->getType(), "Qt", 2) == 0))
    {
        menu.setItemEnabled(6, false);
    }

    switch (menu.exec(pos))
    {
        case 1:
        {
            bool dummy;
            errors = !showReport(lvi, dummy);
            break;
        }
        case 2:
            errors = !generateReport(lvi);
            showReportTab = false;
            break;
        case 3:
            editReport(mr->getProjectReport());
            showReportTab = false;
            break;
        case 4:
            expandLVI(lvi, true);
            break;
        case 5:
            expandLVI(lvi, false);
            break;
        case 6:
            errors = generateReports(lvi);
            break;
        default:
            break;
    }
}
예제 #16
0
HelpWindow::HelpWindow(const QString& home, const QString& path,
		       QWidget* parent, const char* name)
    : QMainWindow(parent, name, WDestructiveClose)
{
    setCaption(tr("Quasar Help"));

    _browser = new QTextBrowser(this);
    _browser->mimeSourceFactory()->setFilePath(path);
    _browser->setFrameStyle(QFrame::Panel | QFrame::Sunken);

    setCentralWidget(_browser);

    if (!home.isEmpty())
	_browser->setSource(home);

    connect(_browser, SIGNAL(highlighted(const QString&)),
	    statusBar(), SLOT(message(const QString&)));

    resize(800, 700);

    QPopupMenu* file = new QPopupMenu(this);
    file->insertItem(tr("&Print"), this, SLOT(print()), ALT | Key_P);
    file->insertSeparator();
    file->insertItem(tr("&Close"), this, SLOT(close()), ALT | Key_Q );

    QPopupMenu* go = new QPopupMenu(this);
    _backwardId = go->insertItem(QPixmap(back_image),
				 tr("&Backward"), _browser, SLOT(backward()),
				 ALT | Key_Left);
    _forwardId = go->insertItem(QPixmap(forward_image),
				tr("&Forward"), _browser, SLOT(forward()),
				ALT | Key_Right);
    _homeId = go->insertItem(QPixmap(home_image),
			     tr("&Home"), _browser, SLOT(home()));

    menuBar()->insertItem(tr("&File"), file);
    menuBar()->insertItem(tr("&Go"), go);

    menuBar()->setItemEnabled(_forwardId, FALSE);
    menuBar()->setItemEnabled(_backwardId, FALSE);
    connect(_browser, SIGNAL(backwardAvailable(bool)),
	    this, SLOT(setBackwardAvailable(bool)));
    connect(_browser, SIGNAL(forwardAvailable(bool)),
	    this, SLOT(setForwardAvailable(bool)));

    QToolBar* toolbar = new QToolBar(this);

    QToolButton* button;
    button = new QToolButton(QPixmap(back_image), tr("Backward"), "",
			     _browser, SLOT(backward()), toolbar);
    connect(_browser, SIGNAL(backwardAvailable(bool)), button,
	    SLOT(setEnabled(bool)));
    button->setEnabled(FALSE);

    button = new QToolButton(QPixmap(forward_image), tr("Forward"), "",
			     _browser, SLOT(forward()), toolbar);
    connect(_browser, SIGNAL(forwardAvailable(bool)), button,
	    SLOT(setEnabled(bool)));
    button->setEnabled(FALSE);

    button = new QToolButton(QPixmap(home_image), tr("Home"), "",
			     _browser, SLOT(home()), toolbar);
    toolbar->addSeparator();

    _browser->setFocus();
}
예제 #17
0
void PaintMainWindow::CreateMenuBar() {
	
	//Create File Menu
	//File Menu Begin
	QPopupMenu* file = new QPopupMenu(this);
	
	//Create Image Section
	file->insertItem("&New image", this, SLOT(OnNewImage()), CTRL+Key_N);
	file->insertItem("&Load image", this, SLOT(OnLoadImage()), CTRL+Key_O);
	file->insertItem("&Save image", this, SLOT(OnSaveImage()), CTRL+Key_S);
	file->insertSeparator();
	
	//Create Color Section
	file->insertItem("&Foreground color", this, SLOT(ChangeFGColor()));
	file->insertItem("&Background color", this, SLOT(ChangeBGColor()));
	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 Edit Menu
	//Edit Menu Begin
	QPopupMenu* edit = new QPopupMenu(this);
	
	//Create Edit items
	edit->insertItem("&Undo", canvas, SLOT(undo()), CTRL+Key_Z);
	edit->insertItem("&Redo", canvas, SLOT(redo()), CTRL+Key_Y);
	edit->insertItem("&Clear All", canvas, SLOT(clearAll()));
	edit->insertItem("Re&size", this, SLOT(OnResizeImage()), CTRL+Key_R);
	
	//Insert Edit Menu
	menuBar()->insertItem("&Edit", edit);
	//Edit Menu End
	
	//Create View Menu
	//View Menu Begin
	QPopupMenu* view = new QPopupMenu(this);
	
	//Create ToolBar toggler
	QAction *ToolBar_t = new QAction("&Tool Bar", 0, this);
	QObject::connect(ToolBar_t, SIGNAL(activated()),
		this, SLOT(ToggleToolBar()));
	//Set ToolBar toggler to be checkable
	ToolBar_t->setToggleAction(true);
	ToolBar_t->setOn(true);
	ToolBar_t->addTo(view);
	//Connect ToolBar state to ToolBar toggler
	QObject::connect(tools, SIGNAL(visibilityChanged(bool)), 
		ToolBar_t, SLOT(toggle()));
	
	
	//Insert View Menu
	menuBar()->insertItem("&View", view);
	//View 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
}
예제 #18
0
파일: layout.cpp 프로젝트: aroraujjwal/qt3
ExampleWidget::ExampleWidget( QWidget *parent, const char *name )
    : QWidget( parent, name )
{
    // Make the top-level layout; a vertical box to contain all widgets
    // and sub-layouts.
    QBoxLayout *topLayout = new QVBoxLayout( this, 5 );

    // Create a menubar...
    QMenuBar *menubar = new QMenuBar( this );
    menubar->setSeparator( QMenuBar::InWindowsStyle );
    QPopupMenu* popup;
    popup = new QPopupMenu( this );
    popup->insertItem( "&Quit", qApp, SLOT(quit()) );
    menubar->insertItem( "&File", popup );

    // ...and tell the layout about it.
    topLayout->setMenuBar( menubar );

    // Make an hbox that will hold a row of buttons.
    QBoxLayout *buttons = new QHBoxLayout( topLayout );
    int i;
    for ( i = 1; i <= 4; i++ ) {
	QPushButton* but = new QPushButton( this );
	QString s;
	s.sprintf( "Button %d", i );
	but->setText( s );

	// Set horizontal stretch factor to 10 to let the buttons
	// stretch horizontally. The buttons will not stretch
	// vertically, since bigWidget below will take up vertical
	// stretch.
	buttons->addWidget( but, 10 );
	// (Actually, the result would have been the same with a
	// stretch factor of 0; if no items in a layout have non-zero
	// stretch, the space is divided equally between members.)
    }

    // Make another hbox that will hold a left-justified row of buttons.
    QBoxLayout *buttons2 = new QHBoxLayout( topLayout );

    QPushButton* but = new QPushButton( "Button five", this );
    buttons2->addWidget( but );

    but = new QPushButton( "Button 6", this );
    buttons2->addWidget( but );

    // Fill up the rest of the hbox with stretchable space, so that
    // the buttons get their minimum width and are pushed to the left.
    buttons2->addStretch( 10 );

    // Make  a big widget that will grab all space in the middle.
    QMultiLineEdit *bigWidget = new QMultiLineEdit( this );
    bigWidget->setText( "This widget will get all the remaining space" );
    bigWidget->setFrameStyle( QFrame::Panel | QFrame::Plain );

    // Set vertical stretch factor to 10 to let the bigWidget stretch
    // vertically. It will stretch horizontally because there are no
    // widgets beside it to take up horizontal stretch.
    //    topLayout->addWidget( bigWidget, 10 );
    topLayout->addWidget( bigWidget ); 

    // Make a grid that will hold a vertical table of QLabel/QLineEdit
    // pairs next to a large QMultiLineEdit.

    // Don't use hard-coded row/column numbers in QGridLayout, you'll
    // regret it when you have to change the layout.
    const int numRows = 3;
    const int labelCol = 0;
    const int linedCol = 1;
    const int multiCol = 2;

    // Let the grid-layout have a spacing of 10 pixels between
    // widgets, overriding the default from topLayout.
    QGridLayout *grid = new QGridLayout( topLayout, 0, 0, 10 );
    int row;

    for ( row = 0; row < numRows; row++ ) {
	QLineEdit *ed = new QLineEdit( this );
	// The line edit goes in the second column
	grid->addWidget( ed, row, linedCol );	

	// Make a label that is a buddy of the line edit
	QString s;
	s.sprintf( "Line &%d", row+1 );
	QLabel *label = new QLabel( ed, s, this );
	// The label goes in the first column.
	grid->addWidget( label, row, labelCol );
    }

    // The multiline edit will cover the entire vertical range of the
    // grid (rows 0 to numRows) and stay in column 2.

    QMultiLineEdit *med = new QMultiLineEdit( this );
    grid->addMultiCellWidget( med, 0, -1, multiCol, multiCol );

    // The labels will take the space they need. Let the remaining
    // horizontal space be shared so that the multiline edit gets
    // twice as much as the line edit.
    grid->setColStretch( linedCol, 10 );
    grid->setColStretch( multiCol, 20 );

    // Add a widget at the bottom.
    QLabel* sb = new QLabel( this );
    sb->setText( "Let's pretend this is a status bar" );
    sb->setFrameStyle( QFrame::Panel | QFrame::Sunken );
    // This widget will use all horizontal space, and have a fixed height.

    // we should have made a subclass and implemented sizePolicy there...
    sb->setFixedHeight( sb->sizeHint().height() );

    sb->setAlignment( AlignVCenter | AlignLeft );
    topLayout->addWidget( sb );

    topLayout->activate();
}
예제 #19
0
파일: toolbar.cpp 프로젝트: alannet/example
ToolbarDemo::ToolbarDemo()
    : QMainWindow(0, "Toolbar Demo")
{

	//主窗口本身是一个高级容器

	//建立动作
	QAction *fileNewAction, *fileOpenAction, *fileSaveAction,
		*fileSaveAsAction, *filePrintAction, *fileCloseAction,
		*fileQuitAction;
	fileNewAction = new QAction( "New", tr("新建(&N)"), 
		CTRL+Key_N, this, "new" );
	connect( fileNewAction, SIGNAL( activated() ) ,this, SLOT( newDoc()));
	fileOpenAction = new QAction( "Open File", QPixmap( fileopen ), 
		tr("打开(&O)"), CTRL+Key_O, this, "open" );
	connect( fileOpenAction, SIGNAL( activated() ) , this, SLOT( load() ) );
	QMimeSourceFactory::defaultFactory()->setPixmap( "fileopen",
		QPixmap( fileopen ) );
	fileOpenAction->setWhatsThis( tr(fileOpenText) );

	fileSaveAction = new QAction( "Save File", QPixmap( filesave ), 
		tr("保存(&S)"), CTRL+Key_S, this, "save" );
	connect( fileSaveAction, SIGNAL( activated() ) , this, SLOT( save() ) );
	fileSaveAction->setWhatsThis( tr(fileSaveText) );

	fileSaveAsAction = new QAction( "Save File As", tr("保存为(&s)..."), 
		0,  this, "save as" );
	connect( fileSaveAsAction, SIGNAL(activated()),this,SLOT( saveAs() ));
	fileSaveAsAction->setWhatsThis( tr(fileSaveText) );
	filePrintAction = new QAction( "Print File", QPixmap( fileprint ), 
		tr("打印(&P)"), CTRL+Key_P, this, "print" );
	connect( filePrintAction, SIGNAL(activated()) , this, SLOT(print()));
	filePrintAction->setWhatsThis( tr(filePrintText) );

	fileCloseAction = new QAction( "Close", tr("关闭(&C)"), CTRL+Key_W, 
		this, "close" );
	connect( fileCloseAction, SIGNAL(activated()) , this, SLOT(close()) );

	fileQuitAction = new QAction( "Quit", tr("退出(&Q)"), CTRL+Key_Q, 
		this, "quit" );
	connect(fileQuitAction,SIGNAL(activated()),qApp,SLOT(closeAllWindows()));


	//建立按钮条
	QToolBar* fileTools = new QToolBar( this, "file operations" );
	fileTools->setLabel( "File Operations" );
	fileOpenAction->addTo( fileTools );
	fileSaveAction->addTo( fileTools );
	filePrintAction->addTo( fileTools );
	(void)QWhatsThis::whatsThisButton( fileTools );


	//建立文件菜单
	QPopupMenu * file = new QPopupMenu( this );
	menuBar()->insertItem( tr("文件(&F)"), file );
	fileNewAction->addTo( file );
	fileOpenAction->addTo( file );
	fileSaveAction->addTo( file );
	fileSaveAsAction->addTo( file );
	file->insertSeparator();
	filePrintAction->addTo( file );
	file->insertSeparator();
	fileCloseAction->addTo( file );
	fileQuitAction->addTo( file );

	//建立帮助菜单
	QPopupMenu * help = new QPopupMenu( this );
	menuBar()->insertSeparator();
	menuBar()->insertItem( tr("帮助(&H)"), help );
	help->insertItem( tr("关于(&A)"), this, SLOT(about()), Key_F1 );
	help->insertItem( tr("关于 &Qt"), this, SLOT(aboutQt()) );
	help->insertSeparator();
	help->insertItem(tr("这是什么?"),this,SLOT(whatsThis()),SHIFT+Key_F1);


	QMultiLineEdit *e = new QMultiLineEdit( this, "editor" );
	e->setFocus();
	setCentralWidget( e );
	statusBar()->message( tr("准备就绪"), 2000 );
	resize( 400, 400 );

}
예제 #20
0
TinyKate::TinyKate( QWidget *parent, const char *name, WFlags f) :
        QMainWindow( parent, name, f )
{
    shutDown=false;
    nextUnnamed=0;
    currentView=0;
    viewCount=0;
    setCaption(tr("TinyKATE"));
    KGlobal::setAppName("TinyKATE");

    QMenuBar *mb = new QMenuBar( this );
    mb->setMargin( 0 );

    tabwidget=new OTabWidget(this);
    setCentralWidget(tabwidget);
    connect(tabwidget,SIGNAL(currentChanged(QWidget*)),this,SLOT(slotCurrentChanged(QWidget*)));

    //FILE ACTIONS
    QPopupMenu *popup = new QPopupMenu( this );

    // Action for creating a new document
    QAction *a = new QAction( tr( "New" ), Opie::Core::OResource::loadPixmap( "new", Opie::Core::OResource::SmallIcon ),
                              QString::null, 0, this, 0 );
    a->addTo( popup );
    connect(a, SIGNAL(activated()), this, SLOT(slotNew()));

    // Action for opening an exisiting document
    a = new QAction( tr( "Open" ), Opie::Core::OResource::loadPixmap( "fileopen", Opie::Core::OResource::SmallIcon ),
                     QString::null, 0, this, 0 );
    a->addTo(popup);
    connect(a, SIGNAL(activated()), this, SLOT(slotOpen()));


    // Action for saving  document
    a = new QAction( tr( "Save" ), Opie::Core::OResource::loadPixmap( "save", Opie::Core::OResource::SmallIcon ),
                     QString::null, 0, this, 0 );
    a->addTo(popup);
    connect(a, SIGNAL(activated()), this, SLOT(slotSave()));

    // Action for saving document to a new name
    a = new QAction( tr( "Save As" ), Opie::Core::OResource::loadPixmap( "save", Opie::Core::OResource::SmallIcon ),
                     QString::null, 0, this, 0 );
    a->addTo(popup);
    connect(a, SIGNAL(activated()), this, SLOT(slotSaveAs()));

    // Action for closing the currently active document
    a = new QAction( tr( "Close" ), Opie::Core::OResource::loadPixmap( "quit_icon", Opie::Core::OResource::SmallIcon ),
                     QString::null, 0, this, 0 );
    a->addTo(popup);
    connect(a, SIGNAL(activated()), this, SLOT(slotClose()));


    mb->insertItem(tr("File"),popup);

    //EDIT ACTIONS
    popup = new QPopupMenu( this );
    bool useBigIcon = qApp->desktop()->size().width() > 330;

    // Action for cutting text
    editCut = new QToolButton( 0 );
    editCut->setUsesBigPixmap( useBigIcon );
    editCut->setAutoRaise( true );
    editCut->setIconSet( Opie::Core::OResource::loadPixmap( "cut", Opie::Core::OResource::SmallIcon ) );

    // Action for Copying text
    editCopy = new QToolButton( 0 );
    editCopy->setUsesBigPixmap( useBigIcon );
    editCopy->setAutoRaise( true );
    editCopy->setIconSet( Opie::Core::OResource::loadPixmap( "copy", Opie::Core::OResource::SmallIcon ) );

    // Action for pasting text
    editPaste =  new QToolButton( 0 );
    editPaste->setUsesBigPixmap( useBigIcon );
    editPaste->setAutoRaise( true );
    editPaste->setIconSet( Opie::Core::OResource::loadPixmap( "paste", Opie::Core::OResource::SmallIcon ) );

    // Action for finding text
    editFind = new QAction( tr( "Find..." ), Opie::Core::OResource::loadPixmap( "find", Opie::Core::OResource::SmallIcon ),
                     QString::null, 0, this, 0 );
    editFind->addTo(popup);

    // Action for replacing text
    editReplace = new QAction( tr( "Replace..." ), QString::null, 0, this, 0 );
    editReplace->addTo(popup);

    // Action for going to a specific line
    editGotoLine = new QAction( tr( "Goto Line..." ), QString::null, 0, this, 0 );
    editGotoLine->addTo(popup);

    // Action for undo
    editUndo = new QToolButton( 0 );
    editUndo->setUsesBigPixmap( useBigIcon );
    editUndo->setAutoRaise( true );
    editUndo->setIconSet( Opie::Core::OResource::loadPixmap( "undo", Opie::Core::OResource::SmallIcon ) );

    // Action for redo
    editRedo = new QToolButton( 0 );
    editRedo->setUsesBigPixmap( useBigIcon );
    editRedo->setAutoRaise( true );
    editRedo->setIconSet( Opie::Core::OResource::loadPixmap( "redo", Opie::Core::OResource::SmallIcon ) );

    mb->insertItem(tr("Edit"),popup);

    //VIEW ACITONS
    popup = new QPopupMenu( this );

    viewIncFontSizes = new QAction( tr( "Font +" ), QString::null, 0, this, 0 );
    viewIncFontSizes->addTo( popup );

    viewDecFontSizes = new QAction( tr( "Font -" ), QString::null, 0, this, 0 );
    viewDecFontSizes->addTo( popup );

    mb->insertItem(tr("View"),popup);

    popup = new QPopupMenu( this );
    mb->insertItem(tr("Utils"),popup);


    mb->insertItem( editCut );
    mb->insertItem( editCopy );
    mb->insertItem( editPaste );
    mb->insertItem( editUndo );
    mb->insertItem(  editRedo );


    //Highlight management
    hlmenu=new QPopupMenu(this);
    HlManager *hlm=HlManager::self();
    for (int i=0;i<hlm->highlights();i++)
    {
        hlmenu->insertItem(hlm->hlName(i),i);
    }
    popup->insertItem(tr("Highlighting"),hlmenu);


    utilSettings = new QAction( tr( "Settings" ),
                                Opie::Core::OResource::loadPixmap( "SettingsIcon", Opie::Core::OResource::SmallIcon ),
                                QString::null, 0, this, 0 );
    utilSettings->addTo( popup);

    if( qApp->argc() > 1) open(qApp->argv()[1]);
    else slotNew();

}
예제 #21
0
void QHTMLView::init()
{
  QString qs;
  QString qs2;
  mpTextBrowser = new QTextBrowser(this);
  mpTextBrowser->setTextFormat(Qt::RichText);
  setCentralWidget(mpTextBrowser);
  qs = xmlConfig->stringValue("HELP_INDEX");
  qs2 = xmlConfig->stringValue("HELP_LAST_PAGE");
  QFile qf1(qs);
  if(qf1.exists()) mpTextBrowser->setSource(qs);
  if(qs != qs2 )
  {
    QFile qf2(qs2);
    if(qf2.exists()) mpTextBrowser->setSource(qs2);
  }
  QPopupMenu* file = new QPopupMenu( this );
  file->insertItem( tr("&Open File"), this, SLOT( openFile() ), ALT | Key_O );
  file->insertSeparator();
  file->insertItem( tr("&Quit"), this, SLOT( close() ), ALT | Key_Q );

  QPopupMenu* go = new QPopupMenu( this );

  mIdBackward = go->insertItem(tr("&Backward"),mpTextBrowser,
                   SLOT( backward() ),ALT | Key_Left );
  mIdForward = go->insertItem(tr("&Forward"),mpTextBrowser,
                   SLOT( forward() ),ALT | Key_Right );
  go->insertItem(tr("&Home"),mpTextBrowser, SLOT( home() ) );

  QPopupMenu* help = new QPopupMenu( this );
  help->insertItem(tr("&About ..."),this,SLOT(about()));

#ifdef KDEAPP
  KMenuBar* mb = new KMenuBar(this);
#else
  QMenuBar* mb = new QMenuBar(this);
#endif
  mb->insertItem(tr("&File"),file);
  mb->insertItem(tr("&Go"),go);
  mb->insertSeparator();
  mb->insertItem(tr("&Help"),help );

  mb->setItemEnabled( mIdForward, false);
  mb->setItemEnabled( mIdBackward, false);

  connect(mpTextBrowser, SIGNAL( backwardAvailable( bool ) ),
    	    this, SLOT( setBackwardAvailable( bool ) ) );
  connect(mpTextBrowser, SIGNAL( forwardAvailable( bool ) ),
	        this, SLOT( setForwardAvailable( bool ) ) );
  connect(mpTextBrowser,SIGNAL(textChanged() ),this,
          SLOT( slotTextChanged() ) );

  QToolBar* toolbar = new QToolBar( this );
  addToolBar( toolbar);
  QToolButton* tb1;

	mPixForward = QPixmap((const char **)forward_xpm);
	mPixBackward = QPixmap((const char **)backward_xpm);
	mPixHome = QPixmap((const char **)home_xpm);

  tb1 = new QToolButton(mPixBackward, tr("Backward"), "", mpTextBrowser,
                        SLOT(backward()), toolbar );
  connect(mpTextBrowser, SIGNAL( backwardAvailable(bool) ),tb1,
          SLOT( setEnabled(bool) ) );
  tb1->setEnabled( false );

  tb1 = new QToolButton(mPixForward, tr("Forward"), "",mpTextBrowser,
                        SLOT(forward()), toolbar );
  connect(mpTextBrowser,SIGNAL(forwardAvailable(bool) ),tb1,
          SLOT( setEnabled(bool) ) );
  tb1->setEnabled( false );

  tb1 = new QToolButton(mPixHome, tr("Home"), "",this,
                        SLOT(home()), toolbar );
  QWidget* dummy = new QWidget(toolbar);
  toolbar->setStretchableWidget(dummy);
  setRightJustification(true);
}
예제 #22
0
Main::Main(QCanvas& c, QWidget* parent, const char* name, WFlags f) :
    QMainWindow(parent,name,f),
    canvas(c)
{
    editor = new FigureEditor(canvas,this); // 繼承canvas view而來
    QMenuBar* menu = menuBar();

    QPopupMenu* file = new QPopupMenu( menu ); // 當parent被刪除,則子類別也會被刪除
    file->insertItem("&Fill canvas", this, SLOT(init()), CTRL+Key_F);
    file->insertItem("&Erase canvas", this, SLOT(clear()), CTRL+Key_E);
    file->insertItem("&New view", this, SLOT(newView()), CTRL+Key_N);
    file->insertSeparator();
    file->insertItem("&Print...", this, SLOT(print()), CTRL+Key_P);
    file->insertSeparator();
    file->insertItem("E&xit", qApp, SLOT(quit()), CTRL+Key_Q);
    menu->insertItem("&File", file); // 建立一個工具列名為File的label

    QPopupMenu* edit = new QPopupMenu( menu );
    edit->insertItem("Add &Circle", this, SLOT(addCircle()), ALT+Key_C);
    edit->insertItem("Add &Hexagon", this, SLOT(addHexagon()), ALT+Key_H);
    edit->insertItem("Add &Polygon", this, SLOT(addPolygon()), ALT+Key_P);
    edit->insertItem("Add Spl&ine", this, SLOT(addSpline()), ALT+Key_I);
    edit->insertItem("Add &Text", this, SLOT(addText()), ALT+Key_T);
    edit->insertItem("Add &Line", this, SLOT(addLine()), ALT+Key_L);
    edit->insertItem("Add &Rectangle", this, SLOT(addRectangle()), ALT+Key_R);
    edit->insertItem("Add &Sprite", this, SLOT(addSprite()), ALT+Key_S);
    edit->insertItem("Create &Mesh", this, SLOT(addMesh()), ALT+Key_M );
    edit->insertItem("Add &Alpha-blended image", this, SLOT(addButterfly()), ALT+Key_A);
    menu->insertItem("&Edit", edit);

    QPopupMenu* view = new QPopupMenu( menu );
    view->insertItem("&Enlarge", this, SLOT(enlarge()), SHIFT+CTRL+Key_Plus);
    view->insertItem("Shr&ink", this, SLOT(shrink()), SHIFT+CTRL+Key_Minus);
    view->insertSeparator();
    view->insertItem("&Rotate clockwise", this, SLOT(rotateClockwise()), CTRL+Key_PageDown);
    view->insertItem("Rotate &counterclockwise", this, SLOT(rotateCounterClockwise()), CTRL+Key_PageUp);
    view->insertItem("&Zoom in", this, SLOT(zoomIn()), CTRL+Key_Plus);
    view->insertItem("Zoom &out", this, SLOT(zoomOut()), CTRL+Key_Minus);
    view->insertItem("Translate left", this, SLOT(moveL()), CTRL+Key_Left);
    view->insertItem("Translate right", this, SLOT(moveR()), CTRL+Key_Right);
    view->insertItem("Translate up", this, SLOT(moveU()), CTRL+Key_Up);
    view->insertItem("Translate down", this, SLOT(moveD()), CTRL+Key_Down);
    view->insertItem("&Mirror", this, SLOT(mirror()), CTRL+Key_Home);
    menu->insertItem("&View", view);

    options = new QPopupMenu( menu );
    dbf_id = options->insertItem("Double buffer", this, SLOT(toggleDoubleBuffer()));
    options->setItemChecked(dbf_id, TRUE);
    menu->insertItem("&Options",options);

    menu->insertSeparator();

    QPopupMenu* help = new QPopupMenu( menu );
    help->insertItem("&About", this, SLOT(help()), Key_F1);
    help->setItemChecked(dbf_id, TRUE); // 很奇怪,當TRUE時,把dbf_id打勾,不懂
    menu->insertItem("&Help",help);

    statusBar();
    // 返回這個窗口的狀態條。如果沒有的話
    // statusBar()會創建一個空的狀態條,並且如果需要也創建一個工具提示組。

    setCentralWidget(editor);

    printer = 0;

    init();
}
예제 #23
0
servercontroller::servercontroller( QWidget*, const char* name )
    : KMainWindow( 0, name )
{
  we_are_exiting = false;
  m_notificationCount = 0;

  m_ncm = new nickColourMaker();

  MenuBar = menuBar();
  KWin::setIcons( winId(), kapp->icon(), kapp->miniIcon() );

  s_self = this;

  switch (ksopts->displayMode)
  {
    case KSOptions::SDI:
        displayMgr = new DisplayMgrSDI();
        break;
    case KSOptions::MDI:
        displayMgr = new DisplayMgrMDI();
        break;
  }

  sci = new scInside(this, QCString(name) + "_mainview");
  setCentralWidget(sci);

  sci->setFrameStyle(QFrame::Box | QFrame::Raised);
  ConnectionTree = sci->ConnectionTree;

  connect(ConnectionTree, SIGNAL(clicked( QListViewItem * )),
	  this, SLOT(WindowSelected(QListViewItem *)));

  setFrameBorderWidth(5);

  QPopupMenu *file = new QPopupMenu(this, QCString(name) + "_menu_file");
  KStdAction::quit(this, SLOT(endksirc()), actionCollection())->plug(file);
#ifndef NDEBUG
  file->insertItem(i18n("Dump Object Tree"), this, SLOT(dump_obj()));
  file->insertItem(i18n("Server Debug Window"), this, SLOT(server_debug()));
#endif
  MenuBar->insertItem(i18n("&File"), file);

  connections = new QPopupMenu(this, QCString(name) + "_menu_connections");

  server_id = connections->insertItem(i18n("&New Server..."), this, SLOT(new_connection()), Key_F2 );
  join_id = connections->insertItem(i18n("&Join Channel..."), this, SLOT(new_channel()), Key_F3 );
  connections->insertSeparator();
  connections->insertItem(i18n("&Do Autoconnect..."), this, SLOT(start_autoconnect_check()));
  connections->setItemEnabled(join_id, FALSE);
  MenuBar->insertItem(i18n("&Connections"), connections);

  options = new QPopupMenu(this, QCString(name) + "_menu_options");
  options->setCheckable(TRUE);

  options->insertItem(SmallIcon( "filter" ), i18n("&Filter Rule Editor..."),
		      this, SLOT(filter_rule_editor()));
  options->insertSeparator();
  KStdAction::configureNotifications(this, SLOT(notification_prefs()), actionCollection())->plug(options);

  KStdAction::preferences(this, SLOT(general_prefs()), actionCollection())->plug(options);

  MenuBar->insertItem(i18n("&Settings"), options);

  KHelpMenu *help = new KHelpMenu( this, kapp->aboutData() );
  MenuBar->insertItem( KStdGuiItem::help().text(), help->menu() );

  m_kga = new KGlobalAccel(this, "globalAccess");
  m_kga->insert("New Server", i18n("New Server"),
		i18n("This action allows you to open a new server more easily "
		     "when in docked mode, since you don't need to click on the "
		     "dock icon."),
		ALT+CTRL+Key_C, KKey::QtWIN+CTRL+Key_C, this,
		SLOT(new_connection()));

  open_toplevels = 0;

  pic_server = UserIcon("server");
  pic_gf = UserIcon("ksirc_a");
  pic_run = UserIcon("mini-run");
  pic_ppl = UserIcon("channels");
  pic_icon = UserIcon("ksirc_b");

  setCaption( i18n("Server Control") );
  KWin::setIcons(winId(), pic_icon, pic_server);

  resize( 450,200 );

  dockWidget = new dockServerController(this, 0x0, "servercontroller_dock");
  KWin::setSystemTrayWindowFor( dockWidget->winId(), winId() );

  m_kga->readSettings();
  m_kga->updateConnections();

  checkDocking();
}
예제 #24
0
파일: qucsfilter.cpp 프로젝트: sibbi77/qucs
QucsFilter::QucsFilter()
{
    // set application icon
    setIcon (QPixmap(QucsSettings.BitmapDir + "big.qucs.xpm"));
    setCaption("Qucs Filter " PACKAGE_VERSION);


    // --------  create menubar  -------------------
    QPopupMenu *fileMenu = new QPopupMenu();
    fileMenu->insertItem(tr("E&xit"), this, SLOT(slotQuit()), CTRL+Key_Q);

    QPopupMenu *helpMenu = new QPopupMenu();
    helpMenu->insertItem(tr("Help..."), this, SLOT(slotHelpIntro()), Key_F1);
    helpMenu->insertSeparator();
    helpMenu->insertItem(
        tr("&About QucsFilter..."), this, SLOT(slotHelpAbout()), 0);
    helpMenu->insertItem(tr("About Qt..."), this, SLOT(slotHelpAboutQt()), 0);

    QMenuBar *bar = new QMenuBar(this);
    bar->insertItem(tr("&File"), fileMenu);
    bar->insertSeparator ();
    bar->insertItem(tr("&Help"), helpMenu);


    // -------  create main windows widgets --------
    gbox = new QGridLayout(this, 10,3,5,5);

    QWidget *Space = new QWidget(this);   // reserve space for menubar
    Space->setFixedSize(5, bar->height());
    gbox->addWidget(Space, 0,0);

    QLabel *Label1 = new QLabel(tr("Filter type:"), this);
    gbox->addWidget(Label1, 1,0);
    ComboType = new QComboBox(this);
    ComboType->insertItem("Bessel");
    ComboType->insertItem("Butterworth");
    ComboType->insertItem("Chebyshev");
    ComboType->insertItem("Cauer");
    gbox->addWidget(ComboType, 1,1);
    connect(ComboType, SIGNAL(activated(int)), SLOT(slotTypeChanged(int)));

    QLabel *Label2 = new QLabel(tr("Filter class:"), this);
    gbox->addWidget(Label2, 2,0);
    ComboClass = new QComboBox(this);
    ComboClass->insertItem(tr("Low pass"));
    ComboClass->insertItem(tr("High pass"));
    ComboClass->insertItem(tr("Band pass"));
    ComboClass->insertItem(tr("Band stop"));
    gbox->addWidget(ComboClass, 2,1);
    connect(ComboClass, SIGNAL(activated(int)), SLOT(slotClassChanged(int)));

    IntVal = new QIntValidator(1, 200, this);
    DoubleVal = new QDoubleValidator(this);

    LabelOrder = new QLabel(tr("Order:"), this);
    gbox->addWidget(LabelOrder, 3,0);
    EditOrder = new QLineEdit("3", this);
    EditOrder->setValidator(IntVal);
    gbox->addWidget(EditOrder, 3,1);

    LabelStart = new QLabel(tr("Corner frequency:"), this);
    gbox->addWidget(LabelStart, 4,0);
    EditCorner = new QLineEdit("1", this);
    EditCorner->setValidator(DoubleVal);
    gbox->addWidget(EditCorner, 4,1);
    ComboCorner = new QComboBox(this);
    ComboCorner->insertItem("Hz");
    ComboCorner->insertItem("kHz");
    ComboCorner->insertItem("MHz");
    ComboCorner->insertItem("GHz");
    ComboCorner->setCurrentItem(3);
    gbox->addWidget(ComboCorner, 4,2);

    LabelStop = new QLabel(tr("Stop frequency:"), this);
    gbox->addWidget(LabelStop, 5,0);
    EditStop = new QLineEdit("2", this);
    EditStop->setValidator(DoubleVal);
    gbox->addWidget(EditStop, 5,1);
    ComboStop = new QComboBox(this);
    ComboStop->insertItem("Hz");
    ComboStop->insertItem("kHz");
    ComboStop->insertItem("MHz");
    ComboStop->insertItem("GHz");
    ComboStop->setCurrentItem(3);
    gbox->addWidget(ComboStop, 5,2);

    LabelBandStop = new QLabel(tr("Stop band frequency:"), this);
    gbox->addWidget(LabelBandStop, 6,0);
    EditBandStop = new QLineEdit("3", this);
    EditBandStop->setValidator(DoubleVal);
    gbox->addWidget(EditBandStop, 6,1);
    ComboBandStop = new QComboBox(this);
    ComboBandStop->insertItem("Hz");
    ComboBandStop->insertItem("kHz");
    ComboBandStop->insertItem("MHz");
    ComboBandStop->insertItem("GHz");
    ComboBandStop->setCurrentItem(3);
    gbox->addWidget(ComboBandStop, 6,2);

    LabelRipple = new QLabel(tr("Pass band ripple:"), this);
    gbox->addWidget(LabelRipple, 7,0);
    EditRipple = new QLineEdit("1", this);
    EditRipple->setValidator(DoubleVal);
    gbox->addWidget(EditRipple, 7,1);
    LabelRipple_dB = new QLabel("dB", this);
    gbox->addWidget(LabelRipple_dB, 7,2);

    LabelAtten = new QLabel(tr("Stop band attenuation:"), this);
    gbox->addWidget(LabelAtten, 8,0);
    EditAtten = new QLineEdit("20", this);
    EditAtten->setValidator(DoubleVal);
    gbox->addWidget(EditAtten, 8,1);
    LabelAtten_dB = new QLabel("dB", this);
    gbox->addWidget(LabelAtten_dB, 8,2);

    QLabel *Label9 = new QLabel(tr("Impedance:"), this);
    gbox->addWidget(Label9, 9,0);
    EditImpedance = new QLineEdit("50", this);
    EditImpedance->setValidator(DoubleVal);
    gbox->addWidget(EditImpedance, 9,1);
    QLabel *Label10 = new QLabel("Ohm", this);
    gbox->addWidget(Label10, 9,2);


    QPushButton *ButtonGo =
        new QPushButton(tr("Calculate and put into Clipboard"), this);
    connect(ButtonGo, SIGNAL(clicked()), SLOT(slotCalculate()));
    gbox->addMultiCellWidget(ButtonGo, 10,10,0,2);

    LabelResult = new QLabel(this);
    ResultState = 100;
    slotShowResult();
    LabelResult->setAlignment(Qt::AlignHCenter);
    gbox->addMultiCellWidget(LabelResult, 11,11,0,2);


    // -------  finally set initial state  --------
    slotTypeChanged(0);
    slotClassChanged(0);
}
예제 #25
0
HelpWindow::HelpWindow( const QString& home_, const QString& _path,
			QWidget* parent, const char *name )
    : QMainWindow( parent, name, WDestructiveClose ),
      pathCombo( 0 ), selectedURL()
{
    readHistory();
    readBookmarks();

    browser = new QTextBrowser( this );
    browser->mimeSourceFactory()->setFilePath( _path );
    browser->setFrameStyle( QFrame::Panel | QFrame::Sunken );
    connect( browser, SIGNAL( textChanged() ),
	     this, SLOT( textChanged() ) );

    setCentralWidget( browser );

    if ( !home_.isEmpty() )
	browser->setSource( home_ );

    connect( browser, SIGNAL( highlighted( const QString&) ),
	     statusBar(), SLOT( message( const QString&)) );

    resize( 640,700 );

    QPopupMenu* file = new QPopupMenu( this );
    file->insertItem( tr("&New Window"), this, SLOT( newWindow() ), ALT | Key_N );
    file->insertItem( tr("&Open File"), this, SLOT( openFile() ), ALT | Key_O );
    file->insertItem( tr("&Print"), this, SLOT( print() ), ALT | Key_P );

    // The same three icons are used twice each.
    QIconSet icon_back( QPixmap("textdrawing/previous.png") );
    QIconSet icon_forward( QPixmap("textdrawing/next.png") );
    QIconSet icon_home( QPixmap("textdrawing/home.png") );

    QPopupMenu* go = new QPopupMenu( this );
    backwardId = go->insertItem( icon_back,
				 tr("&Backward"), browser, SLOT( backward() ),
				 ALT | Key_Left );
    forwardId = go->insertItem( icon_forward,
				tr("&Forward"), browser, SLOT( forward() ),
				ALT | Key_Right );
    go->insertItem( icon_home, tr("&Home"), browser, SLOT( home() ) );

    hist = new QPopupMenu( this );
    QStringList::Iterator it = history.begin();
    for ( ; it != history.end(); ++it )
	mHistory[ hist->insertItem( *it ) ] = *it;
    connect( hist, SIGNAL( activated( int ) ),
	     this, SLOT( histChosen( int ) ) );

    bookm = new QPopupMenu( this );
    bookm->insertItem( tr( "Add Bookmark" ), this, SLOT( addBookmark() ) );
    bookm->insertSeparator();

    QStringList::Iterator it2 = bookmarks.begin();
    for ( ; it2 != bookmarks.end(); ++it2 )
	mBookmarks[ bookm->insertItem( *it2 ) ] = *it2;
    connect( bookm, SIGNAL( activated( int ) ),
	     this, SLOT( bookmChosen( int ) ) );

    menuBar()->insertItem( tr("&File"), file );
    menuBar()->insertItem( tr("&Go"), go );
    menuBar()->insertItem( tr( "History" ), hist );
    menuBar()->insertItem( tr( "Bookmarks" ), bookm );

    menuBar()->setItemEnabled( forwardId, FALSE);
    menuBar()->setItemEnabled( backwardId, FALSE);
    connect( browser, SIGNAL( backwardAvailable( bool ) ),
	     this, SLOT( setBackwardAvailable( bool ) ) );
    connect( browser, SIGNAL( forwardAvailable( bool ) ),
	     this, SLOT( setForwardAvailable( bool ) ) );


    QToolBar* toolbar = new QToolBar( this );
    addToolBar( toolbar, "Toolbar");
    QToolButton* button;

    button = new QToolButton( icon_back, tr("Backward"), "", browser, SLOT(backward()), toolbar );
    connect( browser, SIGNAL( backwardAvailable(bool) ), button, SLOT( setEnabled(bool) ) );
    button->setEnabled( FALSE );
    button = new QToolButton( icon_forward, tr("Forward"), "", browser, SLOT(forward()), toolbar );
    connect( browser, SIGNAL( forwardAvailable(bool) ), button, SLOT( setEnabled(bool) ) );
    button->setEnabled( FALSE );
    button = new QToolButton( icon_home, tr("Home"), "", browser, SLOT(home()), toolbar );

    toolbar->addSeparator();

    pathCombo = new QComboBox( TRUE, toolbar );
    connect( pathCombo, SIGNAL( activated( const QString & ) ),
	     this, SLOT( pathSelected( const QString & ) ) );
    toolbar->setStretchableWidget( pathCombo );
    setRightJustification( TRUE );
    setDockEnabled( DockLeft, FALSE );
    setDockEnabled( DockRight, FALSE );

    pathCombo->insertItem( home_ );

    browser->setFocus();
}
예제 #26
0
파일: kbbgame.cpp 프로젝트: xwizard/kde1
KBBGame::KBBGame() : KTopLevelWidget()     
{
  int i;

  setCaption(QString("KBlackBox ")+KBVERSION);

  menu                = new KMenuBar(this, "menu");
  QPopupMenu *game    = new QPopupMenu;
  QPopupMenu *file    = new QPopupMenu;
  sizesm  = new QPopupMenu;
  ballsm  = new QPopupMenu;
  QPopupMenu *help = new QPopupMenu;
  options = new QPopupMenu;
 
  CHECK_PTR( file );
  CHECK_PTR( game );
  CHECK_PTR( help );
  CHECK_PTR( sizesm );
  CHECK_PTR( ballsm );
  CHECK_PTR( options );
  CHECK_PTR( menu );

  help->insertItem( trans->translate("&Help"), ID_HELP );
  help->setAccel( CTRL+Key_H, ID_HELP );
  help->insertSeparator();
  help->insertItem( trans->translate("&About KBlackBox"), ID_ABOUT );
  help->setAccel( CTRL+Key_A, ID_ABOUT );
  help->insertItem( trans->translate("About &Qt"), ID_ABOUT_QT );

		    
  file->insertItem( trans->translate("&Quit"), ID_QUIT );
  file->setAccel( CTRL+Key_Q, ID_QUIT );

  game->insertItem( trans->translate("&New"), ID_NEW );
  game->insertItem( trans->translate("&Give up"), ID_GIVEUP );
  game->insertItem( trans->translate("&Done"), ID_DONE );
  game->insertSeparator();
  game->insertItem( trans->translate("&Resize"), ID_RESIZE );

  sizes1id = sizesm->insertItem( "  8 x 8  ", this, SLOT(size1()) );
  sizes2id = sizesm->insertItem( " 10 x 10 ", this, SLOT(size2()) );
  sizes3id = sizesm->insertItem( " 12 x 12 ", this, SLOT(size3()) );
  sizesm->setCheckable( TRUE );

  balls1id = ballsm->insertItem( " 4 ", this, SLOT(balls1()) );
  balls2id = ballsm->insertItem( " 6 ", this, SLOT(balls2()) );
  balls3id = ballsm->insertItem( " 8 ", this, SLOT(balls3()) );
  ballsm->setCheckable( TRUE );

  options->insertItem( trans->translate("&Size"), sizesm );  
  options->insertItem( trans->translate("&Balls"), ballsm );
  tut1id = options->insertItem( trans->translate("&Tutorial"),
				this, SLOT(tutorialSwitch()) );
  options->setCheckable( TRUE );

  connect( file, SIGNAL(activated(int)), SLOT(callBack(int)) );
  connect( help, SIGNAL(activated(int)), SLOT(callBack(int)) );
  connect( game, SIGNAL(activated(int)), SLOT(callBack(int)) );
 
  menu->insertItem( trans->translate("&File"), file );
  menu->insertItem( trans->translate("&Game"), game );
  menu->insertItem( trans->translate("&Options"), options );
  menu->insertSeparator();
  menu->insertItem( trans->translate("&Help"), help );

  menu->show(); 
  setMenu( menu );

  KIconLoader *loader = kapp->getIconLoader();
  QPixmap **pix = new QPixmap*[NROFTYPES];
  pix[0] = new QPixmap();
  *pix[0] = loader->loadIcon( pFNames[0] );
  if (!pix[0]->isNull()) {
    debug( "Pixmap \"%s\" loaded.", pFNames[0] );
    for (i = 1; i < NROFTYPES; i++) {
      pix[i] = new QPixmap;
      *pix[i] = loader->loadIcon( pFNames[i] );
      if (!pix[i]->isNull()) {
	debug( "Pixmap \"%s\" loaded.", pFNames[i] );
      } else {
	pix[i] = pix[i-1];
	pix[i]->detach();
	debug( "Cannot find pixmap \"%s\". Using previous one.", pFNames[i] );
      }
    }
  } else {
    debug( "Cannot find pixmap \"%s\". Pixmaps will not be loaded.",
	   pFNames[0] );
    delete pix[0];
    delete pix;
    pix = NULL;
  }
  gr = new KBBGraphic( pix, this );
  connect( gr, SIGNAL(inputAt(int,int,int)),
	  this, SLOT(gotInputAt(int,int,int)) );
  connect( this, SIGNAL(gameRuns(bool)),
	  gr, SLOT(setInputAccepted(bool)) );
  connect( gr, SIGNAL(endMouseClicked()),
	  this, SLOT(gameFinished()) );
  
  /*
  QToolTip::add( doneButton, trans->translate(
		 "Click here when you think you placed all the balls.") );
		 */

  QString tmps;
  stat = new KStatusBar( this );
  tmps.sprintf( "aaaaaaaa" );
  stat->insertItem( (const char *) tmps, SSCORE );
  tmps.sprintf( "aaaaaaaaaaa" );
  stat->insertItem( (const char *) tmps, SBALLS );
  tmps.sprintf( "aaaaaaa" );
  stat->insertItem( (const char *) tmps, SRUN );
  tmps.sprintf( "aaaaaaaaaa" );
  stat->insertItem( (const char *) tmps, SSIZE );
  setStatusBar( stat );

  tool = new KToolBar( this );
  tool->insertButton( loader->loadIcon("exit.xpm"),
		      ID_QUIT, TRUE, trans->translate("Quit") );
  tool->insertButton( loader->loadIcon("reload.xpm"),
		      ID_NEW, TRUE, trans->translate("New") );
  tool->insertButton( loader->loadIcon("giveup.xpm"),
		      ID_GIVEUP, TRUE, trans->translate("Give up") );
  tool->insertButton( loader->loadIcon("done.xpm"),
		      ID_DONE, TRUE, trans->translate("Done") );
  tool->insertSeparator();
  tool->insertButton( loader->loadIcon("help.xpm"), ID_HELP, TRUE,
		      trans->translate("Help") );
  connect( tool, SIGNAL(clicked(int)), SLOT(callBack(int)) );
  addToolBar( tool );
  tool->setBarPos( KToolBar::Top );
  tool->show();
  
  /*
     Game initializations
  */
  running = FALSE;
  gameBoard = NULL;

  KConfig *kConf;
  int j;
  kConf = KApplication::getKApplication()->getConfig();
  kConf->setGroup( "KBlackBox Setup" );
  if (kConf->hasKey( "Balls" )) {
    i = kConf->readNumEntry( "Balls" );
    balls = i;
    switch (i) {
    case 4: ballsm->setItemChecked( balls1id, TRUE ); break;
    case 6: ballsm->setItemChecked( balls2id, TRUE ); break;
    case 8: ballsm->setItemChecked( balls3id, TRUE ); break;
    }
  } else {
    balls = 4;
    ballsm->setItemChecked( balls1id, TRUE );
  }
  if ((kConf->hasKey( "Width" )) &&
      (kConf->hasKey( "Balls" ))) {
    i = kConf->readNumEntry( "Width" );
    j = kConf->readNumEntry( "Height" );
    gr->setSize( i+4, j+4 ); // +4 is the space for "lasers" and an edge...
    gameBoard = new RectOnArray( gr->numC(), gr->numR() );
    switch (i) {
    case 8: sizesm->setItemChecked( sizes1id, TRUE ); break;
    case 10: sizesm->setItemChecked( sizes2id, TRUE ); break;
    case 12: sizesm->setItemChecked( sizes3id, TRUE ); break;
    }
  } else {
    gr->setSize( 8+4, 8+4 ); // +4 is the space for "lasers" and an edge...
    gameBoard = new RectOnArray( gr->numC(), gr->numR() );
    sizesm->setItemChecked( sizes1id, TRUE );
  }
  if (kConf->hasKey( "tutorial" )) {
    tutorial = (bool) kConf->readNumEntry( "tutorial" );
  } else tutorial = FALSE;
  options->setItemChecked( tut1id, tutorial );

  QString s, s1;
  int pos;
  setMinSize();
  gameResize();
  if (kConf->hasKey( "appsize" )) {
    s = kConf->readEntry( "appsize" );
    debug("%s", (const char *) s);
    pos = s.find( 'x' );
    s1 = s.right( s.length() - pos - 1 );
    s.truncate( pos - 1 );
    //    debug("%s", (const char *) s);
    //    debug("%s", (const char *) s1);
    resize( s.toInt(), s1.toInt() );
  }

  setScore( 0 );
  ballsPlaced = 0;
  updateStats();

  setView( gr );

  newGame();
}
예제 #27
0
MenuExample::MenuExample( QWidget *parent, const char *name )
    : QWidget( parent, name )
{
    QPixmap p1( p1_xpm );
    QPixmap p2( p2_xpm );
    QPixmap p3( p3_xpm );

    QPopupMenu *print = new QPopupMenu( this );
    CHECK_PTR( print );
    print->insertTearOffHandle();
    print->insertItem( "&Print to printer", this, SLOT(printer()) );
    print->insertItem( "Print to &file", this, SLOT(file()) );
    print->insertItem( "Print to fa&x", this, SLOT(fax()) );
    print->insertSeparator();
    print->insertItem( "Printer &Setup", this, SLOT(printerSetup()) );

    QPopupMenu *file = new QPopupMenu( this );
    CHECK_PTR( file );
    file->insertItem( p1, "&Open",  this, SLOT(open()), CTRL+Key_O );
    file->insertItem( p2, "&New", this, SLOT(news()), CTRL+Key_N );
    file->insertItem( p3, "&Save", this, SLOT(save()), CTRL+Key_S );
    file->insertItem( "&Close", this, SLOT(closeDoc()), CTRL+Key_W );
    file->insertSeparator();
    file->insertItem( "&Print", print, CTRL+Key_P );
    file->insertSeparator();
    file->insertItem( "E&xit",  qApp, SLOT(quit()), CTRL+Key_Q );

    QPopupMenu *edit = new QPopupMenu( this );
    CHECK_PTR( edit );
    int undoID = edit->insertItem( "&Undo", this, SLOT(undo()) );
    int redoID = edit->insertItem( "&Redo", this, SLOT(redo()) );
    edit->setItemEnabled( undoID, FALSE );
    edit->setItemEnabled( redoID, FALSE );

    QPopupMenu* options = new QPopupMenu( this );
    CHECK_PTR( options );
    options->insertTearOffHandle();
    options->setCaption("Options");
    options->insertItem( "&Normal Font", this, SLOT(normal()) );
    options->insertSeparator();

    options->polish(); // adjust system settings
    QFont f = options->font();
    f.setBold( TRUE );
    boldID = options->insertItem( new MyMenuItem( "Bold", f ) );
    options->setAccel( CTRL+Key_B, boldID );
    options->connectItem( boldID, this, SLOT(bold()) );
    f = font();
    f.setUnderline( TRUE );
    underlineID = options->insertItem( new MyMenuItem( "Underline", f ) );
    options->setAccel( CTRL+Key_U, underlineID );
    options->connectItem( underlineID, this, SLOT(underline()) );

    isBold = FALSE;
    isUnderline = FALSE;
    options->setCheckable( TRUE );


    QPopupMenu *help = new QPopupMenu( this );
    CHECK_PTR( help );
    help->insertItem( "&About", this, SLOT(about()), CTRL+Key_H );
    help->insertItem( "About &Qt", this, SLOT(aboutQt()) );

    menu = new QMenuBar( this );
    CHECK_PTR( menu );
    menu->insertItem( "&File", file );
    menu->insertItem( "&Edit", edit );
    menu->insertItem( "&Options", options );
    menu->insertSeparator();
    menu->insertItem( "&Help", help );
    menu->setSeparator( QMenuBar::InWindowsStyle );

    label = new QLabel( this );
    CHECK_PTR( label );
    label->setGeometry( 20, rect().center().y()-20, width()-40, 40 );
    label->setFrameStyle( QFrame::Box | QFrame::Raised );
    label->setLineWidth( 1 );
    label->setAlignment( AlignCenter );

    connect( this,  SIGNAL(explain(const QString&)),
             label, SLOT(setText(const QString&)) );

    setMinimumSize( 100, 80 );
}
예제 #28
0
FilterDialog::FilterDialog (QWidget * parent) : QDialog (parent)
{
  // set application icon
  setIcon (QPixmap(":/bitmaps/big.qucs.xpm"));
  setCaption("Qucs Filter " PACKAGE_VERSION);

  all = new QVBoxLayout(this);

  // --------  create menubar  -------------------
  QPopupMenu *fileMenu = new QPopupMenu();
  fileMenu->insertItem(tr("E&xit"), this, SLOT(slotQuit()), Qt::CTRL+Qt::Key_Q);

  QPopupMenu *helpMenu = new QPopupMenu();
  helpMenu->insertItem(
                tr("&About Qucs Filter..."), this, SLOT(slotHelpAbout()), 0);
  helpMenu->insertItem(tr("About Qt..."), this, SLOT(slotHelpAboutQt()), 0);

  QMenuBar *bar = new QMenuBar(this);
  bar->insertItem(tr("&File"), fileMenu);
  bar->insertSeparator ();
  bar->insertItem(tr("&Help"), helpMenu);
  all->addWidget(bar);

  // reserve space for menubar
  all->addSpacing (bar->height() + 2);

  QTabWidget *t = new QTabWidget(this);
  all->addWidget(t);

  // ...........................................................
  QWidget *Tab1 = new QWidget(t);
  QGridLayout *gp1 = new QGridLayout(Tab1,12,6,5,5);

  FilterName = new QComboBox(false, Tab1);
  gp1->addWidget(FilterName,0,0);
  TformName = new QComboBox(false, Tab1);
  gp1->addWidget(TformName,0,1);

  OrderBox = new QCheckBox(tr("Specify order"), Tab1);
  gp1->addWidget(OrderBox,1,0);
  QHBox *h1 = new QHBox(Tab1);
  h1->setSpacing (5);
  OrderCombo = new QComboBox(false, h1);
  OrderCombo->setEnabled(true);
  SubOrderCombo = new QComboBox(false, h1);
  SubOrderCombo->setEnabled(false);
  SubOrderCombo->insertItem( tr( "b" ) );
  SubOrderCombo->insertItem( tr( "c" ) );
  gp1->addWidget(h1,1,1);

  CutoffLabel = new QLabel(tr("Cutoff/Center"),Tab1);
  gp1->addWidget(CutoffLabel,2,0);
  EnterCutoff = new QLineEdit(Tab1);
  gp1->addWidget(EnterCutoff,2,1);
  CutoffCombo = new QComboBox(Tab1);
  CutoffCombo->insertItem( tr( "Hz" ) );
  CutoffCombo->insertItem( tr( "kHz" ) );
  CutoffCombo->insertItem( tr( "MHz" ) );
  CutoffCombo->insertItem( tr( "GHz" ) );
  gp1->addWidget(CutoffCombo,2,2);

  RippleLabel = new QLabel(tr("Ripple"),Tab1);
  gp1->addWidget(RippleLabel,3,0);
  EnterRipple = new QLineEdit(Tab1);
  gp1->addWidget(EnterRipple,3,1);
  RippleUnitLabel = new QLabel(tr("dB"),Tab1);
  gp1->addWidget(RippleUnitLabel,3,2);

  AngleLabel = new QLabel(tr("Angle"),Tab1);
  gp1->addWidget(AngleLabel,3,3);
  EnterAngle = new QLineEdit(Tab1);
  gp1->addWidget(EnterAngle,3,4);
  AngleUnitLabel = new QLabel(tr("°"),Tab1);
  gp1->addWidget(AngleUnitLabel,3,5);

  ZinLabel = new QLabel(tr("Zin"),Tab1);
  gp1->addWidget(ZinLabel,7,0);
  EnterZin = new QLineEdit(Tab1);
  gp1->addWidget(EnterZin,7,1);
  OhmLabel = new QLabel(tr("Ohm"),Tab1);
  gp1->addWidget(OhmLabel,7,2);

  ZoutLabel = new QLabel(tr("Zout"),Tab1);
  ZoutLabel->setEnabled(false);
  gp1->addWidget(ZoutLabel,7,3);
  EnterZout = new QLineEdit(Tab1);
  gp1->addWidget(EnterZout,7,4);
  OhmLabel_2 = new QLabel(tr("Ohm"),Tab1);
  gp1->addWidget(OhmLabel_2,7,5);

  StopbandLabel = new QLabel(tr("Stopband corner"),Tab1);
  gp1->addWidget(StopbandLabel,5,0);
  EnterStopband = new QLineEdit(Tab1);
  gp1->addWidget(EnterStopband,5,1);
  StopbandCombo = new QComboBox(false, Tab1);
  StopbandCombo->insertItem( tr( "Hz" ) );
  StopbandCombo->insertItem( tr( "kHz" ) );
  StopbandCombo->insertItem( tr( "MHz" ) );
  StopbandCombo->insertItem( tr( "GHz" ) );
  gp1->addWidget(StopbandCombo,5,2);

  BandwidthLabel = new QLabel(tr("Bandwidth"),Tab1);
  BandwidthLabel->setEnabled(false);
  gp1->addWidget(BandwidthLabel,4,0);
  EnterBandwidth = new QLineEdit(Tab1);
  gp1->addWidget(EnterBandwidth,4,1);
  BandwidthCombo = new QComboBox(false, Tab1);
  BandwidthCombo->setEnabled(false);
  BandwidthCombo->insertItem( tr( "Hz" ) );
  BandwidthCombo->insertItem( tr( "kHz" ) );
  BandwidthCombo->insertItem( tr( "MHz" ) );
  BandwidthCombo->insertItem( tr( "GHz" ) );
  gp1->addWidget(BandwidthCombo,4,2);

  AttenuationLabel = new QLabel(tr("Attenuation"),Tab1);
  gp1->addWidget(AttenuationLabel,6,0);
  EnterAttenuation = new QLineEdit(Tab1);
  gp1->addWidget(EnterAttenuation,6,1);
  dBLabel = new QLabel(tr("dB"),Tab1);
  gp1->addWidget(dBLabel,6,2);

  DualBox = new QCheckBox(tr("dual"),Tab1);
  gp1->addMultiCellWidget(DualBox,8,8,0,2);
  CauerPoleBox = new QCheckBox(tr("Stopband is first pole"),Tab1);
  CauerPoleBox->setEnabled(false);
  gp1->addMultiCellWidget(CauerPoleBox,9,9,0,2);
  OptimizeCauerBox = new QCheckBox(tr("Optimize cauer"),Tab1);
  OptimizeCauerBox->setEnabled(false);
  gp1->addMultiCellWidget(OptimizeCauerBox,10,10,0,2);
  EqualInductorBox = new QCheckBox(tr("Equal inductors"),Tab1);
  EqualInductorBox->setEnabled(false);
  gp1->addMultiCellWidget(EqualInductorBox,8,8,3,5);
  UseCrossBox = new QCheckBox(tr("+ rather than T"),Tab1);
  UseCrossBox->setEnabled(false);
  gp1->addMultiCellWidget(UseCrossBox,9,9,3,5);

  Cboxes = new QVButtonGroup(tr("Optimize C"),Tab1);
  Cmin = new QRadioButton(tr("Cmin"),Cboxes);
  Cmax = new QRadioButton(tr("Cmax"),Cboxes);
  NoC = new QRadioButton(tr("noC"),Cboxes);
  gp1->addMultiCellWidget(Cboxes,11,11,0,2);

  Lboxes = new QVButtonGroup(tr("Optimize L"),Tab1);
  Lmin = new QRadioButton(tr("Lmin"),Lboxes);
  Lmax = new QRadioButton(tr("Lmax"),Lboxes);
  NoL = new QRadioButton(tr("noL"),Lboxes);
  gp1->addMultiCellWidget(Lboxes,11,11,3,5);

  t->addTab(Tab1, tr("LC Filters"));

  // ...........................................................
  QWidget *Tab2 = new QWidget(t);
  t->addTab(Tab2, tr("Microstrip Filters"));

  // ...........................................................
  QWidget *Tab3 = new QWidget(t);
  t->addTab(Tab3, tr("Active Filters"));

  // reserve space for vertical resizing
  all->addStretch();

  // ...........................................................
  // buttons on the bottom of the dialog (independent of the TabWidget)
  QHBox *Butts = new QHBox(this);
  Butts->setSpacing(3);
  Butts->setMargin(3);
  all->addWidget(Butts);

  cancelButton = new QPushButton(tr("Exit"),Butts);
  okButton = new QPushButton(tr("Calculate"),Butts);
  okButton->setEnabled(false);

  // signals and slots connections
  connect( cancelButton, SIGNAL( clicked() ), this, SLOT( reject() ) );
  connect( okButton, SIGNAL( clicked() ), this, SLOT( accept() ) );
}
예제 #29
0
SpawnListMenu::SpawnListMenu(SEQListView* spawnlist,
                             SEQWindow* spawnlistWindow,
                             FilterMgr* filterMgr,
                             CategoryMgr* categoryMgr,
                             QWidget* parent, const char* name)
    : m_spawnlist(spawnlist),
      m_spawnlistWindow(spawnlistWindow),
      m_filterMgr(filterMgr),
      m_categoryMgr(categoryMgr)
{
    // Show Columns
    QPopupMenu* spawnListColMenu = new QPopupMenu;
    insertItem( "Show &Column", spawnListColMenu);
    spawnListColMenu->setCheckable(true);
    m_id_spawnList_Cols[tSpawnColName] =
        spawnListColMenu->insertItem("&Name");
    spawnListColMenu->setItemParameter(m_id_spawnList_Cols[tSpawnColName],
                                       tSpawnColName);
    m_id_spawnList_Cols[tSpawnColLevel] = spawnListColMenu->insertItem("&Level");
    spawnListColMenu->setItemParameter(m_id_spawnList_Cols[tSpawnColLevel],
                                       tSpawnColLevel);
    m_id_spawnList_Cols[tSpawnColHP] = spawnListColMenu->insertItem("&HP");
    spawnListColMenu->setItemParameter(m_id_spawnList_Cols[tSpawnColHP],
                                       tSpawnColHP);
    m_id_spawnList_Cols[tSpawnColMaxHP] = spawnListColMenu->insertItem("&Max HP");
    spawnListColMenu->setItemParameter(m_id_spawnList_Cols[tSpawnColMaxHP],
                                       tSpawnColMaxHP);
    m_id_spawnList_Cols[tSpawnColXPos] = spawnListColMenu->insertItem("Coord &1");
    spawnListColMenu->setItemParameter(m_id_spawnList_Cols[tSpawnColXPos],
                                       tSpawnColXPos);
    m_id_spawnList_Cols[tSpawnColYPos] = spawnListColMenu->insertItem("Coord &2");
    spawnListColMenu->setItemParameter(m_id_spawnList_Cols[tSpawnColYPos],
                                       tSpawnColYPos);
    m_id_spawnList_Cols[tSpawnColZPos] = spawnListColMenu->insertItem("Coord &3");
    spawnListColMenu->setItemParameter(m_id_spawnList_Cols[tSpawnColZPos],
                                       tSpawnColZPos);
    m_id_spawnList_Cols[tSpawnColID] = spawnListColMenu->insertItem("I&D");
    spawnListColMenu->setItemParameter(m_id_spawnList_Cols[tSpawnColID],
                                       tSpawnColID);
    m_id_spawnList_Cols[tSpawnColDist] = spawnListColMenu->insertItem("&Dist");
    spawnListColMenu->setItemParameter(m_id_spawnList_Cols[tSpawnColDist],
                                       tSpawnColDist);
    m_id_spawnList_Cols[tSpawnColRace] = spawnListColMenu->insertItem("&Race");
    spawnListColMenu->setItemParameter(m_id_spawnList_Cols[tSpawnColRace],
                                       tSpawnColRace);
    m_id_spawnList_Cols[tSpawnColClass] = spawnListColMenu->insertItem("&Class");
    spawnListColMenu->setItemParameter(m_id_spawnList_Cols[tSpawnColClass],
                                       tSpawnColClass);
    m_id_spawnList_Cols[tSpawnColInfo] = spawnListColMenu->insertItem("&Info");
    spawnListColMenu->setItemParameter(m_id_spawnList_Cols[tSpawnColInfo],
                                       tSpawnColInfo);
    m_id_spawnList_Cols[tSpawnColSpawnTime] = spawnListColMenu->insertItem("Spawn &Time");
    spawnListColMenu->setItemParameter(m_id_spawnList_Cols[tSpawnColSpawnTime],
                                       tSpawnColSpawnTime);
    m_id_spawnList_Cols[tSpawnColDeity] = spawnListColMenu->insertItem("&Deity");
    spawnListColMenu->setItemParameter(m_id_spawnList_Cols[tSpawnColDeity],
                                       tSpawnColDeity);
    m_id_spawnList_Cols[tSpawnColBodyType] = spawnListColMenu->insertItem("&Body Type");
    spawnListColMenu->setItemParameter(m_id_spawnList_Cols[tSpawnColBodyType],
                                       tSpawnColBodyType);
    m_id_spawnList_Cols[tSpawnColGuildID] = spawnListColMenu->insertItem("Guild Tag");
    spawnListColMenu->setItemParameter(m_id_spawnList_Cols[tSpawnColGuildID],
                                       tSpawnColGuildID);

    connect (spawnListColMenu, SIGNAL(activated(int)),
             this, SLOT(toggle_spawnListCol(int)));

    int x;
    QPopupMenu* filterMenu = new QPopupMenu;
    m_id_filterMenu = insertItem("Add &Filter", filterMenu);
    setItemEnabled(m_id_filterMenu, false);
    x = filterMenu->insertItem("&Hunt...");
    filterMenu->setItemParameter(x, HUNT_FILTER);
    x = filterMenu->insertItem("&Caution...");
    filterMenu->setItemParameter(x, CAUTION_FILTER);
    x = filterMenu->insertItem("&Danger...");
    filterMenu->setItemParameter(x, DANGER_FILTER);
    x = filterMenu->insertItem("&Locate...");
    filterMenu->setItemParameter(x, LOCATE_FILTER);
    x = filterMenu->insertItem("&Alert...");
    filterMenu->setItemParameter(x, ALERT_FILTER);
    x = filterMenu->insertItem("&Filtered...");
    filterMenu->setItemParameter(x, FILTERED_FILTER);
    x = filterMenu->insertItem("&Tracer...");
    filterMenu->setItemParameter(x, TRACER_FILTER);
    connect (filterMenu, SIGNAL(activated(int)),
             this, SLOT(add_filter(int)));

    QPopupMenu* zoneFilterMenu = new QPopupMenu;
    m_id_zoneFilterMenu = insertItem("Add &Zone Filter", zoneFilterMenu);
    setItemEnabled(m_id_zoneFilterMenu, false);
    x = zoneFilterMenu->insertItem("&Hunt...");
    zoneFilterMenu->setItemParameter(x, HUNT_FILTER);
    x = zoneFilterMenu->insertItem("&Caution...");
    zoneFilterMenu->setItemParameter(x, CAUTION_FILTER);
    x = zoneFilterMenu->insertItem("&Danger...");
    zoneFilterMenu->setItemParameter(x, DANGER_FILTER);
    x = zoneFilterMenu->insertItem("&Locate...");
    zoneFilterMenu->setItemParameter(x, LOCATE_FILTER);
    x = zoneFilterMenu->insertItem("&Alert...");
    zoneFilterMenu->setItemParameter(x, ALERT_FILTER);
    x = zoneFilterMenu->insertItem("&Filtered...");
    zoneFilterMenu->setItemParameter(x, FILTERED_FILTER);
    x = zoneFilterMenu->insertItem("&Tracer...");
    zoneFilterMenu->setItemParameter(x, TRACER_FILTER);
    connect (zoneFilterMenu, SIGNAL(activated(int)),
             this, SLOT(add_zoneFilter(int)));

    insertSeparator(-1);

    x = insertItem("&Add Category...", this, SLOT(add_category(int)));
    m_id_edit_category =
        insertItem("&Edit Category...", this, SLOT(edit_category(int)));
    m_id_delete_category =
        insertItem("&Delete Category...", this, SLOT(delete_category(int)));
    insertItem("&Reload Categories", this, SLOT(reload_categories(int)));
    insertSeparator(-1);
    insertItem("&Font...", this, SLOT(set_font(int)));
    insertItem("&Caption...", this, SLOT(set_caption(int)));

    connect(this, SIGNAL(aboutToShow()),
            this, SLOT(init_Menu()));
}
예제 #30
0
파일: ClsIqrGUI.cpp 프로젝트: jeez/iqr
void ClsIqrGUI::createMenubar() {
    /* FILE */
    file = new QPopupMenu( this );
    menuBar()->insertItem( "&File", file );
    file-> insertTearOffHandle();
    file->insertItem( QPixmap( fileopen ), "&Open", this, SLOT(slotOpenSystem()), CTRL+Key_O, FILE_OPEN );
    file->insertItem( QPixmap( filenew ), "&New System", this, SLOT(slotNewSystem()), CTRL+Key_N, FILE_NEW_SYSTEM);
    file->insertSeparator();
    file->insertItem(QPixmap( fileclose ), "&Close System", this, SLOT( slotCloseSystem() ), 0, FILE_CLOSE_SYSTEM);
//    file->insertItem( "Save System (DEBUG)", this, SLOT(slotDebugSaveSystem()));
    file->insertItem(QPixmap( filesave ), "Save &System", this, SLOT(slotSaveSystem()), CTRL+Key_S, FILE_SAVE_SYSTEM);
    file->insertItem(QPixmap( filesaveas ), "Save System &As", this, SLOT(slotSaveSystemAs()), CTRL+Key_A, FILE_SAVE_SYSTEM_AS);
    file->insertItem( "&Export for AER", this, SLOT(slotExportSystemForAER()), CTRL+Key_E, FILE_EXPORT_FOR_AER);
    file->insertSeparator();
    file->insertItem(QPixmap( systemproperties ), "System Properties", this, SLOT( slotSystemProperties() ), 0, FILE_SYSTEM_PROPERTIES);
    file->insertSeparator();
    file->insertItem( QPixmap( quit ), "&Quit iqr", this, SLOT( slotQuitIQR() ), 0, FILE_QUIT);
    file->insertSeparator();

    list<string> lstLFO = ClsFESettings::instance().getListLastFiles();
    while (lstLFO.size()) {
	string strFilename = lstLFO.front();
	int iID = file->insertItem( strFilename.c_str(), this, SLOT( slotOpenOldFile(int)));
	file->setItemParameter( iID, iID );
	lstLFO.pop_front();
    }

    file->setItemEnabled (FILE_SAVE_SYSTEM,       false);

    /* EDIT */
    edit = new QPopupMenu( this );
    menuBar()->insertItem( "&Edit", edit );
    edit->insertItem(QPixmap(paste),  "Paste", this, SLOT( slotPaste() ), 0, ClsIqrGUI::ITEM_PASTE);
    edit->insertSeparator();
    edit->insertItem( "Settings", this, SLOT( slotSettings() ));
    edit->insertItem( "Validate System", this, SLOT( slotValidateSystem() ));


    /* VIEW */
    view = new QPopupMenu( this );
    menuBar()->insertItem( "&View", view );
    view->insertItem(  "&Log", this, SLOT(slotShowLogWindow()), CTRL+Key_L );


    /* DIAGRAM */
    QPopupMenu * qpmDiagram = new QPopupMenu( this );
    menuBar()->insertItem( "&Diagram", qpmDiagram );
    qpmDiagram-> insertTearOffHandle();
    qpmDiagram->insertItem("Save Diagram", this, SLOT(slotSaveDiagram()));
    qpmDiagram->insertItem("Print Diagram", this, SLOT(slotPrintDiagram()));


    /* DATA */
    QPopupMenu * DAV = new QPopupMenu( this );
    menuBar()->insertItem( "D&ata", DAV );
    DAV-> insertTearOffHandle();
    DAV->insertItem( "Data Sampler", MENU_DATA_SAMPLER, -1 );
    DAV->insertSeparator();
    DAV->insertItem( "Open Configuration", ClsFEDataManager::Instance(), SLOT( applyConfig() ));
    DAV->insertItem( "&Save Configuration", ClsFEDataManager::Instance(), SLOT( saveConfig() ));

    connect( DAV, SIGNAL(activated(int)), SLOT(slotDAVMenu(int)) );
}