Example #1
0
MonitorWindow::MonitorWindow(NetmonitorPlugin *plugin)
        : QMainWindow(NULL, "monitor", WType_TopLevel)
{
    m_plugin = plugin;
    SET_WNDPROC("monitor")
    setCaption(i18n("Network monitor"));
    setIcon(Pict("network"));
    bPause = false;
    edit = new TextShow(this);
    edit->setWordWrap(QTextEdit::NoWrap);
    setCentralWidget(edit);
    QMenuBar *menu = menuBar();
    menuFile = new QPopupMenu(this);
    connect(menuFile, SIGNAL(aboutToShow()), this, SLOT(adjustFile()));
    menuFile->insertItem(Pict("filesave"), i18n("&Save"), this, SLOT(save()), 0, mnuSave);
    menuFile->insertItem(i18n("&Pause"), this, SLOT(pause()), 0, mnuPause);
    menuFile->insertSeparator();
    menuFile->insertItem(Pict("exit"), i18n("E&xit"), this, SLOT(exit()), 0, mnuExit);
    menu->insertItem(i18n("&File"), menuFile);
    menuEdit = new QPopupMenu(this);
    connect(menuEdit, SIGNAL(aboutToShow()), this, SLOT(adjustEdit()));
    menuEdit->insertItem(i18n("&Copy"), this, SLOT(copy()), 0, mnuCopy);
    menuEdit->insertItem(i18n("&Erase"), this, SLOT(erase()), 0, mnuErase);
    menu->insertItem(i18n("&Edit"), menuEdit);
    menuLog = new QPopupMenu(this);
    menuLog->setCheckable(true);
    connect(menuLog, SIGNAL(aboutToShow()), this, SLOT(adjustLog()));
    connect(menuLog, SIGNAL(activated(int)), this, SLOT(toggleType(int)));
    menu->insertItem(i18n("&Log"), menuLog);
}
Example #2
0
Main::Main(QGraphicsScene& c, QWidget* parent, const char* name, Qt::WindowFlags f) :
    Q3MainWindow(parent,name,f),
    canvas(c)
{
    editor = new FigureEditor(canvas,this);
    QMenuBar* menu = menuBar();

    Q3PopupMenu* file = new Q3PopupMenu( menu );
    file->insertItem("&Fill canvas", this, SLOT(init()), Qt::CTRL+Qt::Key_F);
    file->insertItem("&Erase canvas", this, SLOT(clear()), Qt::CTRL+Qt::Key_E);
    file->insertItem("&New view", this, SLOT(newView()), Qt::CTRL+Qt::Key_N);
    file->insertSeparator();
    file->insertItem("&Print...", this, SLOT(print()), Qt::CTRL+Qt::Key_P);
    file->insertSeparator();
    file->insertItem("E&xit", qApp, SLOT(quit()), Qt::CTRL+Qt::Key_Q);
    menu->insertItem("&File", file);

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

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

    menu->insertSeparator();

    Q3PopupMenu* help = new Q3PopupMenu( menu );
    help->insertItem("&About", this, SLOT(help()), Qt::Key_F1);
    help->setItemChecked(dbf_id, TRUE);
    menu->insertItem("&Help",help);

    statusBar();

    setCentralWidget(editor);

    printer = 0;

    init();
}
Example #3
0
Frame::Frame( QWidget *parent, const char *name )
    : QMainWindow( parent, name )
{
    QMenuBar *mainMenu = menuBar();
    QPopupMenu *fileMenu = new QPopupMenu( this, "file" );
    fileMenu->insertItem( tr( "&Exit" ), this, SLOT( close() ),
			  QAccel::stringToKey( tr( "Ctrl+Q" ) ) );

    QPopupMenu *styleMenu = new QPopupMenu( this, "style" );
    styleMenu->setCheckable( TRUE );
    QActionGroup *ag = new QActionGroup( this, 0 );
    ag->setExclusive( TRUE );
    QSignalMapper *styleMapper = new QSignalMapper( this );
    connect( styleMapper, SIGNAL( mapped( const QString& ) ),
	     this, SLOT( setStyle( const QString& ) ) );

    QStringList list = QStyleFactory::keys();
    list.sort();
    QDict<int> stylesDict( 17, FALSE );
    for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) {
	QString style = *it;
	QString styleAccel = style;
	if ( stylesDict[styleAccel.left(1)] ) {
	    for ( uint i = 0; i < styleAccel.length(); i++ ) {
		if ( !stylesDict[styleAccel.mid( i, 1 )] ) {
		    stylesDict.insert(styleAccel.mid( i, 1 ), (const int *)1);
		    styleAccel = styleAccel.insert( i, '&' );
		    break;
		}
	    }
	} else {
	    stylesDict.insert(styleAccel.left(1), (const int *)1);
	    styleAccel = "&"+styleAccel;
	}
	QAction *a = new QAction( style, QIconSet(),
				  styleAccel, 0, ag, 0, ag->isExclusive() );
	connect( a, SIGNAL( activated() ), styleMapper, SLOT(map()) );
	styleMapper->setMapping( a, a->text() );
    }
    ag->addTo( styleMenu );

    mainMenu->insertItem( tr( "&File" ), fileMenu );
    mainMenu->insertItem( tr( "St&yle" ), styleMenu );

    stack = new QWidgetStack( this );

    setCentralWidget( stack );
}
Example #4
0
MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) {
    setCaption(tr("IRC Client"));
    m_tabWidget = new IRCTabWidget(this);
    QWhatsThis::add(m_tabWidget, tr("Server connections, channels, queries and other things will be placed here"));
    connect(m_tabWidget, SIGNAL(currentChanged(QWidget*)), this, SLOT(selected(QWidget*)));
    setCentralWidget(m_tabWidget);
    setToolBarsMovable(FALSE);
    QMenuBar *menuBar = new QMenuBar(this);
    QPopupMenu *irc = new QPopupMenu(this);
    menuBar->insertItem(tr("IRC"), irc);
    QAction *a = new QAction( tr("New connection"),
                              Opie::Core::OResource::loadPixmap( "pass", Opie::Core::OResource::SmallIcon ),
                              QString::null, 0, this, 0 );
    connect(a, SIGNAL(activated()), this, SLOT(newConnection()));
    a->setWhatsThis(tr("Create a new connection to an IRC server"));
    a->addTo(irc);
    a = new QAction( tr("Settings"),
                     Opie::Core::OResource::loadPixmap( "SettingsIcon", Opie::Core::OResource::SmallIcon ),
                     QString::null, 0, this, 0 );
    a->setWhatsThis(tr("Configure OpieIRC's behavior and appearance"));
    connect(a, SIGNAL(activated()), this, SLOT(settings()));
    a->addTo(irc);
    m_dccTab = 0;
    loadSettings();
}
Example #5
0
void SBookWidget::CreateMenuBar(QLayout *topLayout)
{
    QMenuBar *menubar = new QMenuBar( this );
    menubar->setSeparator( QMenuBar::InWindowsStyle );


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

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

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

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

    // ...and tell the layout about it.
    topLayout->setMenuBar( menubar );
}
Example #6
0
GLObjectWindow::GLObjectWindow( QWidget* parent, const char* name )
    : QWidget( parent, name )
{

    // Create nice frames to put around the OpenGL widgets
    QFrame* f1 = new QFrame( this, "frame1" );
    f1->setFrameStyle( QFrame::Sunken | QFrame::Panel );
    f1->setLineWidth( 2 );

    // Create an OpenGL widget
    GLTexobj* c = new GLTexobj( f1, "glbox1");

    // Create a menu
    QPopupMenu *file = new QPopupMenu( this );
    file->insertItem( "Toggle Animation", c, SLOT(toggleAnimation()),
                      CTRL+Key_A );
    file->insertSeparator();
    file->insertItem( "Exit",  qApp, SLOT(quit()), CTRL+Key_Q );

    // Create a menu bar
    QMenuBar *m = new QMenuBar( this );
    m->setSeparator( QMenuBar::InWindowsStyle );
    m->insertItem("&File", file );

    // Create the three sliders; one for each rotation axis
    QSlider* x = new QSlider ( 0, 360, 60, 0, QSlider::Vertical, this, "xsl" );
    x->setTickmarks( QSlider::Left );
    connect( x, SIGNAL(valueChanged(int)), c, SLOT(setXRotation(int)) );

    QSlider* y = new QSlider ( 0, 360, 60, 0, QSlider::Vertical, this, "ysl" );
    y->setTickmarks( QSlider::Left );
    connect( y, SIGNAL(valueChanged(int)), c, SLOT(setYRotation(int)) );

    QSlider* z = new QSlider ( 0, 360, 60, 0, QSlider::Vertical, this, "zsl" );
    z->setTickmarks( QSlider::Left );
    connect( z, SIGNAL(valueChanged(int)), c, SLOT(setZRotation(int)) );


    // Now that we have all the widgets, put them into a nice layout

    // Put the sliders on top of each other
    QVBoxLayout* vlayout = new QVBoxLayout( 20, "vlayout");
    vlayout->addWidget( x );
    vlayout->addWidget( y );
    vlayout->addWidget( z );

    // Put the GL widget inside the frame
    QHBoxLayout* flayout1 = new QHBoxLayout( f1, 2, 2, "flayout1");
    flayout1->addWidget( c, 1 );

    // Top level layout, puts the sliders to the left of the frame/GL widget
    QHBoxLayout* hlayout = new QHBoxLayout( this, 20, 20, "hlayout");
    hlayout->setMenuBar( m );
    hlayout->addLayout( vlayout );
    hlayout->addWidget( f1, 1 );

}
Example #7
0
void MainWindow::initUI() {
/*
 * We want to provde a File Menu with Quit as option
 * and a Fire Toolbutton ( QAction )
 * So we need two actions
 * A toolbar and a popupMenu
 */
    setToolBarsMovable( false );
    /*
     *We don't want the static toolbar but share it with the
     * toolbar on small screens
     */
    QToolBar *menuBarHolder = new QToolBar( this );
    /* we allow the menubarholder to become bigger than
     * the screen width and to offer a > for the additional items
     */
    menuBarHolder->setHorizontalStretchable( true );
    QMenuBar *mb = new QMenuBar( menuBarHolder );
    QToolBar *tb = new QToolBar( this );

    QPopupMenu *fileMenu = new QPopupMenu( this );

    /*
     * we create our first action with the Text Quit
     * a IconSet, no menu name, no acceleration ( keyboard shortcut ),
     * with parent this, and name "quit_action"
     */
    /*
     * Note if you want a picture out of  the inline directory
     * you musn't prefix inline/ inline means these pics are built in
     * into libqpe so the name without ending and directory is enough
     */
    QAction *a = new QAction( tr("Quit"), Opie::Core::OResource::loadPixmap("quit_icon", Opie::Core::OResource::SmallIcon),
                              QString::null, 0, this, "quit_action" );
    /*
     * Connect quit to the QApplication quit slot
     */
    connect(a, SIGNAL(activated() ),
            qApp, SLOT(quit() ) );
    a->addTo( fileMenu );

   a =  new QAction(tr("Fire"),
                             Opie::Core::OResource::loadPixmap("new", Opie::Core::OResource::SmallIcon),
                             QString::null, 0, this, "fire_button");

    /* see  the power? */
    a->addTo( fileMenu );
    a->addTo( tb );
    m_fire = a;


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

}
Example #8
0
FifteenMainWindow::FifteenMainWindow(QWidget *parent, const char* name, WFlags fl)
  : QMainWindow( parent, name, fl )
{

  // random seed
  srand(time(0));
  setCaption( tr("Fifteen Pieces") );

  QToolBar *toolbar = new QToolBar(this);
  toolbar->setHorizontalStretchable( FALSE );
  QMenuBar *menubar = new QMenuBar( toolbar );
  menubar->setMargin(0);
  QPopupMenu *game = new QPopupMenu( this );
  menubar->insertItem( tr( "Game" ), game );

  QWidget *spacer = new QWidget( toolbar );
  spacer->setBackgroundMode( PaletteButton );
  toolbar->setStretchableWidget( spacer );


  setToolBarsMovable( FALSE );
  QVBox *vbox = new QVBox( this );
  PiecesTable *table = new PiecesTable( vbox );
  setCentralWidget(vbox);



  QAction *a = new QAction( tr( "Randomize" ), Opie::Core::OResource::loadPixmap( "new", Opie::Core::OResource::SmallIcon ),
			    QString::null, 0, this, 0 );
  connect( a, SIGNAL( activated() ), table, SLOT( slotRandomize() ) );
  a->addTo( game );
  a->addTo( toolbar );


  a  = new QAction( tr("Configure"), Opie::Core::OResource::loadPixmap( "SettingsIcon", Opie::Core::OResource::SmallIcon ),
                    QString::null, 0, this, 0 );
  connect( a, SIGNAL( activated()), table, SLOT( slotConfigure()) );
  a->addTo( game );
}
Example #9
0
GLObjectWindow::GLObjectWindow( QWidget* parent, const char* name )
    : QWidget( parent, name )
{
    // Create a menu
    QPopupMenu *file = new QPopupMenu( this );
    file->insertItem( "Exit",  qApp, SLOT(quit()), CTRL+Key_Q );

    // Create a menu bar
    QMenuBar *m = new QMenuBar( this );
    m->setSeparator( QMenuBar::InWindowsStyle );
    m->insertItem("&File", file );

    // Create a nice frame to put around the OpenGL widget
    QFrame* f = new QFrame( this, "frame" );
    f->setFrameStyle( QFrame::Sunken | QFrame::Panel );
    f->setLineWidth( 2 );

    // Create our OpenGL widget.
    GLTeapots* c = new GLTeapots( f, "glteapots" );

    // Check if we obtained an overlay
    if ( !c->format().hasOverlay() ) {
	QMessageBox::warning( 0, qApp->argv()[0], 
			      "Failed to get an OpenGL overlay",
			      "Ok" );
    }

    // Now that we have all the widgets, put them into a nice layout

    // Put the GL widget inside the frame
    QHBoxLayout* flayout = new QHBoxLayout( f, 2, 2, "flayout");
    flayout->addWidget( c, 1 );

    // Top level layout
    QVBoxLayout* hlayout = new QVBoxLayout( this, 20, 20, "hlayout");
    hlayout->setMenuBar( m );
    hlayout->addWidget( f, 1 );
}
Example #10
0
QTExamWindow::QTExamWindow( QWidget* parent, const char* name, WFlags f )
	: QMainWindow( parent, name, f )
{
	setCaption("QTExam");

	QAction *actFileNew  = new QAction( "New", "&New", CTRL+Key_N, this, "new" );
	QAction *actFileQuit = new QAction( "Quit", "&Quit", CTRL+Key_Q, this, "quit" );

	connect( actFileNew,  SIGNAL( activated() ), this, SLOT( newDocument() ) );
	connect( actFileQuit, SIGNAL( activated() ), qApp, SLOT( quit() ) );

	QPopupMenu *menuFile = new QPopupMenu( this );
	actFileNew->addTo( menuFile );
	menuFile->insertSeparator();
	actFileQuit->addTo( menuFile );

	QMenuBar *menuMain = menuBar();
	menuMain->insertItem( "&File", menuFile );

	table = new QTable( 52, 12, this );
	table->setFocus();
	setCentralWidget( table );
}
Example #11
0
GLObjectWindow::GLObjectWindow( QWidget* parent, const char* name )
    : QWidget( parent, name )
{
    // Create a menu
    QPopupMenu *file = new QPopupMenu( this );
    file->insertItem( "Delete Left QGLWidget", this, 
		      SLOT(deleteFirstWidget()) );
    file->insertItem( "Exit",  qApp, SLOT(quit()), CTRL+Key_Q );

    // Create a menu bar
    QMenuBar *m = new QMenuBar( this );
    m->setSeparator( QMenuBar::InWindowsStyle );
    m->insertItem("&File", file );

    // Create nice frames to put around the OpenGL widgets
    QFrame* f1 = new QFrame( this, "frame1" );
    f1->setFrameStyle( QFrame::Sunken | QFrame::Panel );
    f1->setLineWidth( 2 );
    QFrame* f2 = new QFrame( this, "frame2" );
    f2->setFrameStyle( QFrame::Sunken | QFrame::Panel );
    f2->setLineWidth( 2 );

    // Create an OpenGL widget
    c1 = new GLBox( f1, "glbox1" );
    
    // Create another OpenGL widget that shares display lists with the first
    c2 = new GLBox( f2, "glbox2", c1 );

    // Create the three sliders; one for each rotation axis
    // Make them spin the boxes, but not in synch
    QSlider* x = new QSlider ( 0, 360, 60, 0, QSlider::Vertical, this, "xsl" );
    x->setTickmarks( QSlider::Left );
    connect( x, SIGNAL(valueChanged(int)), c1, SLOT(setXRotation(int)) );
    connect( x, SIGNAL(valueChanged(int)), c2, SLOT(setZRotation(int)) );

    QSlider* y = new QSlider ( 0, 360, 60, 0, QSlider::Vertical, this, "ysl" );
    y->setTickmarks( QSlider::Left );
    connect( y, SIGNAL(valueChanged(int)), c1, SLOT(setYRotation(int)) );
    connect( y, SIGNAL(valueChanged(int)), c2, SLOT(setXRotation(int)) );

    QSlider* z = new QSlider ( 0, 360, 60, 0, QSlider::Vertical, this, "zsl" );
    z->setTickmarks( QSlider::Left );
    connect( z, SIGNAL(valueChanged(int)), c1, SLOT(setZRotation(int)) );
    connect( z, SIGNAL(valueChanged(int)), c2, SLOT(setYRotation(int)) );


    // Now that we have all the widgets, put them into a nice layout

    // Put the sliders on top of each other
    QVBoxLayout* vlayout = new QVBoxLayout( 20, "vlayout");
    vlayout->addWidget( x );
    vlayout->addWidget( y );
    vlayout->addWidget( z );

    // Put the GL widgets inside the frames
    QHBoxLayout* flayout1 = new QHBoxLayout( f1, 2, 2, "flayout1");
    flayout1->addWidget( c1, 1 );
    QHBoxLayout* flayout2 = new QHBoxLayout( f2, 2, 2, "flayout2");
    flayout2->addWidget( c2, 1 );

    // Top level layout, puts the sliders to the left of the frame/GL widget
    QHBoxLayout* hlayout = new QHBoxLayout( this, 20, 20, "hlayout");
    hlayout->setMenuBar( m );
    hlayout->addLayout( vlayout );
    hlayout->addWidget( f1, 1 );
    hlayout->addWidget( f2, 1 );

}
Example #12
0
void MainWindow::makeMenu()
{
    QToolBar *toolBar = new QToolBar( this );
    QToolBar *searchBar = new QToolBar(this);
    QMenuBar *menuBar = new QMenuBar( toolBar );
    QPopupMenu *searchMenu = new QPopupMenu( menuBar );
//    QPopupMenu *viewMenu = new QPopupMenu( menuBar );
    QPopupMenu *cfgMenu = new QPopupMenu( menuBar );
    QPopupMenu *searchOptions = new QPopupMenu( cfgMenu );

    setToolBarsMovable( false );
    toolBar->setHorizontalStretchable( true );
    menuBar->insertItem( tr( "Search" ), searchMenu );
    menuBar->insertItem( tr( "Settings" ), cfgMenu );

    //SETTINGS MENU
    cfgMenu->insertItem( tr( "Search" ), searchOptions );
    QPopupMenu *pop;
    for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ){
        pop = s->popupMenu();
        if (pop){
            cfgMenu->insertItem( s->text(0), pop );
        }
    }


    //SEARCH
    SearchAllAction = new QAction( tr("Search all"),QString::null,  0, this, 0 );
    SearchAllAction->setIconSet( Opie::Core::OResource::loadPixmap( "find", Opie::Core::OResource::SmallIcon ) );
//    QWhatsThis::add( SearchAllAction, tr("Search everything...") );
    connect( SearchAllAction, SIGNAL(activated()), this, SLOT(searchAll()) );
    SearchAllAction->addTo( searchMenu );
    searchMenu->insertItem( tr( "Options" ), searchOptions );

    //SEARCH OPTIONS
    //actionWholeWordsOnly = new QAction( tr("Whole words only"),QString::null,  0, this, 0, true );
    //actionWholeWordsOnly->addTo( searchOptions );
    actionCaseSensitiv = new QAction( tr("Case sensitive"),QString::null,  0, this, 0, true );
    actionCaseSensitiv->addTo( searchOptions );
    actionWildcards = new QAction( tr("Use wildcards"),QString::null,  0, this, 0, true );
    actionWildcards->addTo( searchOptions );

    //SEARCH BAR
    LabelEnterText = new QLabel( searchBar, "Label" );
    LabelEnterText->setAutoMask( FALSE );
    LabelEnterText->setText( tr( "Search for: " ) );
    LabelEnterText->setFrameStyle( QFrame::NoFrame );
    LabelEnterText->setBackgroundMode( PaletteButton );

    addToolBar( searchBar, "Search", QMainWindow::Top, TRUE );
    QLineEdit *searchEdit = new QLineEdit( searchBar, "seachEdit" );
    QWhatsThis::add( searchEdit, tr("Enter your search terms here") );
    searchEdit->setFocus();
    searchBar->setHorizontalStretchable( TRUE );
    searchBar->setStretchableWidget( searchEdit );

    //Search button
    SearchAllAction->addTo( searchBar );

    //Clear text
    ClearSearchText = new QToolButton( searchBar, "ClearSearchText");
    ClearSearchText->setText( "" );
    ClearSearchText->setPixmap( Opie::Core::OResource::loadPixmap( "close", Opie::Core::OResource::SmallIcon ) );

    connect( searchEdit, SIGNAL( textChanged(const QString&) ),this, SLOT( setSearch(const QString&) ) );
    connect( ClearSearchText, SIGNAL( clicked() ), searchEdit, SLOT( clear() ) );
}
Example #13
0
Tab_Logins::Tab_Logins
(
	QWidget* parent,
	const char* name,
	long CustID
) : TAAWidget(parent)
{

	setCaption( "Logins" );
	myCustID = CustID;


    // Create all of our widgets.
    list = new Q3ListView(this, "LoginList");
	list->addColumn("Login ID");
	list->addColumn("Login Type");
	list->addColumn("Contact Name");
	list->addColumn("Last Modified");
	list->addColumn("Disk");
	list->addColumn("Flags");
	list->addColumn("Active");
	list->setAllColumnsShowFocus(TRUE);
	list->setColumnAlignment(4, AlignRight);
	list->setColumnAlignment(5, AlignRight);
	list->setColumnAlignment(6, AlignCenter);
    list->setItemMargin( 2 );

    newButton = new QPushButton(this, "NewButton");
    newButton->setText("&New");
    connect(newButton, SIGNAL(clicked()), this, SLOT(createNewLogin()));

    openCloseButton = new QPushButton(this, "OpenCloseButton");
    openCloseButton->setText("(&De)Activate");
    connect(openCloseButton, SIGNAL(clicked()), this, SLOT(unlockLogin()));

    passwdButton = new QPushButton(this, "PasswdButton");
    passwdButton->setText("&Password");
    connect(passwdButton, SIGNAL(clicked()), this, SLOT(changePassword()));

    QPushButton *loginFlagsButton = new QPushButton(this, "LoginFlagsButton");
    loginFlagsButton->setText("Fla&gs");
    connect(loginFlagsButton, SIGNAL(clicked()), this, SLOT(loginFlagsClicked()));

    editButton = new QPushButton(this, "EditButton");
    editButton->setText("&Edit");
    connect(editButton, SIGNAL(clicked()), this, SLOT(editLogin()));

    modemUsageButton = new QPushButton(this, "Modem Usage Button");
    modemUsageButton->setText("&Modem Usage");
    connect(modemUsageButton, SIGNAL(clicked()), this, SLOT(modemUsageReport()));

    bandwidthButton = new QPushButton(this, "BandwidthButton");
    bandwidthButton->setText("&Bandwidth");
    connect(bandwidthButton, SIGNAL(clicked()), this, SLOT(bandwidthUsageReport()));

    QPushButton *diskSpaceButton = new QPushButton(this, "DiskSpaceButton");
    diskSpaceButton->setText("D&isk Space");
    connect(diskSpaceButton, SIGNAL(clicked()), this, SLOT(diskSpaceClicked()));
    diskSpaceButton->setEnabled(false);
    
    adminMenuArea = new QLabel(this, "Admin Menu Area");
    adminMenu = new Q3PopupMenu;
    adminMenu->insertItem("&Set Primary Login", this, SLOT(setPrimaryLogin()));
    adminMenu->insertItem("&Transfer Login", this, SLOT(transferLogin()));
    if (isAdmin()) adminMenu->insertItem("&Wipe Login", this, SLOT(wipeLogin()));
	
	QMenuBar    *tmpMenu;
	tmpMenu = new QMenuBar(adminMenuArea, "Administrivia");
    tmpMenu->insertItem("&Administrivia", adminMenu);

    hideWiped = new QCheckBox(this, "HideWiped");
    hideWiped->setText("&Hide Wiped");
    hideWiped->setChecked(true);
    connect(hideWiped, SIGNAL(toggled(bool)), this, SLOT(hideWipedChanged(bool)));

    // Create our layouts.  A top to bottom box, with a grid in it.
    Q3BoxLayout *ml = new Q3BoxLayout(this, Q3BoxLayout::TopToBottom, 3, 3);
    ml->addWidget(list, 1);

    Q3GridLayout *bl = new Q3GridLayout(2, 6);
    bl->addWidget(newButton,            0, 0);
    bl->addWidget(openCloseButton,      0, 1);
    bl->addWidget(passwdButton,         0, 2);
    bl->addWidget(loginFlagsButton,     0, 3);
    bl->addWidget(adminMenuArea,        0, 5);
    
    bl->addWidget(editButton,           1, 0);
    bl->addWidget(modemUsageButton,     1, 1);
    bl->addWidget(bandwidthButton,      1, 2);
    bl->addWidget(diskSpaceButton,      1, 3);
    bl->addWidget(hideWiped,            1, 5);

    for (int i = 0 ; i < 5; i++) bl->setColStretch(i, 1);
    bl->setRowStretch(0, 0);
    bl->setRowStretch(1, 0);

    ml->addLayout(bl, 0);

	
	
	// QObject::connect(listtitle, SIGNAL(widthChanged(int, int)),
	//  list, SLOT(setColumnWidth(int, int)));
	
	refreshLoginList(0);
	
	if (!isManager()) {
		// wipeButton->hide();
		adminMenuArea->hide();
	}

}
Example #14
0
int main(int argc, char** argv)
{
    bool timeit = FALSE;
    QApplication app(argc,argv);

    bool scrollbars=FALSE;

    for (int arg=1; arg<argc; arg++) {
	if (0==strcmp(argv[arg],"-bounce")) {
	    bouncers=atoi(argv[++arg]);
	} else if (0==strcmp(argv[arg],"-help") ||
		   0==strcmp(argv[arg],"--help")) {
	    showtext=FALSE;
	} else if (0==strcmp(argv[arg],"-redraws")) {
	    showredraws=TRUE;
	} else if (0==strcmp(argv[arg],"-lines")) {
	    showlines=TRUE;
	} else if (0==strcmp(argv[arg],"-btext")) {
	    btext=FALSE;
	} else if (0==strcmp(argv[arg],"-dsprite")) {
	    dsprite=FALSE;
	} else if (0==strcmp(argv[arg],"-dpoly")) {
	    dpoly=!dpoly;
	} else if (0==strcmp(argv[arg],"-delay")) {
	    refresh_delay=atoi(argv[++arg]);
	} else if (0==strcmp(argv[arg],"-sb")) {
	    scrollbars=TRUE;
	} else if (0==strcmp(argv[arg],"-noopt")) {
	    QPixmap::setDefaultOptimization( QPixmap::NoOptim );
	} else if (0==strcmp(argv[arg],"-bestopt")) {
	    QPixmap::setDefaultOptimization( QPixmap::BestOptim );
#ifdef _WS_WIN_
	} else if (0==strcmp(argv[arg],"-bsm")) {
	    extern bool qt_bitblt_bsm;
	    qt_bitblt_bsm=TRUE;
#endif
	} else if (0==strcmp(argv[arg],"-iter")) {
	    iterations=atoi(argv[++arg]);
	    timeit = TRUE;
	} else {
	    warning("Bad param %s", argv[arg]);
	}
    }

    QMainWindow m;
    MySpriteField field(IMG_BACKGROUND,scrollbars ? WIDTH*3 : WIDTH,
		scrollbars ? HEIGHT*3 : HEIGHT);
    Example example(scrollbars,field,&m);

    QMenuBar* menu = m.menuBar();

    QPopupMenu* file = new QPopupMenu;
    file->insertItem("New view", &example, SLOT(makeSlave()), CTRL+Key_N);
    file->insertSeparator();
    file->insertItem("Quit", qApp, SLOT(quit()), CTRL+Key_Q);
    menu->insertItem("&File", file);

    QPopupMenu* edit = new QPopupMenu;
    edit->insertItem("New polygon", &example, SLOT(makePolygon()));
    edit->insertItem("New ellipse", &example, SLOT(makeEllipse()));
    edit->insertItem("New rectangle", &example, SLOT(makeRectangle()));
    menu->insertItem("&Edit", edit);

    MyPopupMenu* options = new MyPopupMenu;
    options->insertCheckItem("Show help text", &showtext, CTRL+Key_H);
    options->insertCheckItem("Show bouncing text", &btext, CTRL+Key_T);
    options->insertCheckItem("Show polygon", &dpoly, CTRL+Key_P);
    options->insertCheckItem("Show drawn sprite", &dsprite, CTRL+Key_D);
    options->insertCheckItem("Show redraw areas", &showredraws, CTRL+Key_A);
    options->insertCheckItem("Show foreground lines", &showlines, CTRL+Key_L);
    options->insertSeparator();
    options->insertRadioItem("1 bouncer", &bouncers, 1);
    options->insertRadioItem("3 bouncers", &bouncers, 3);
    options->insertRadioItem("10 bouncers", &bouncers, 10);
    options->insertRadioItem("30 bouncers", &bouncers, 30);
    options->insertRadioItem("100 bouncers", &bouncers, 100);
    options->insertRadioItem("1000 bouncers", &bouncers, 1000);
    options->insertSeparator();
    options->insertRadioItem("No delay", &refresh_delay, 0);
    options->insertRadioItem("500 fps", &refresh_delay, 2);
    options->insertRadioItem("100 fps", &refresh_delay, 10);
    options->insertRadioItem("72 fps", &refresh_delay, 14);
    options->insertRadioItem("30 fps", &refresh_delay, 33);
    options->insertRadioItem("10 fps", &refresh_delay, 100);
    options->insertRadioItem("5 fps", &refresh_delay, 200);
    options->insertSeparator();
    options->insertRadioItem("1/10 speed", &speed, 2);
    options->insertRadioItem("1/2 speed", &speed, 10);
    options->insertRadioItem("1x speed", &speed, 20);
    options->insertRadioItem("2x speed", &speed, 40);
    options->insertRadioItem("5x speed", &speed, 100);
    menu->insertItem("&Options",options);
    m.statusBar();

    QObject::connect(options, SIGNAL(variableChanged(bool*)), &example, SLOT(refresh()));
    QObject::connect(options, SIGNAL(variableChanged(int*)), &example, SLOT(refresh()));
    QObject::connect(&example, SIGNAL(status(const char*)), m.statusBar(), SLOT(message(const char*)));
    m.setCentralWidget(&example);
    app.setMainWidget(&m);
    m.show();

    QTime t;
    t.start();
    app.exec();
    if ( timeit )
	debug("%dms",t.elapsed());
    return 0;
}
Example #15
0
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);
}
Example #16
0
WordsEdit::WordsEdit( QWidget *parent, const char *name, int win_num, ResourcesWin *res )
    : QWidget( parent, name ,Qt::WDestructiveClose )
{
  
  setCaption("WORDS.TOK Editor");
  wordlist = new WordList();

  winnum = win_num;
  resources_win = res;
  wordsfind = NULL;
  
  Q3PopupMenu *file = new Q3PopupMenu( this );
  Q_CHECK_PTR( file );

  file->insertItem( "New", this, SLOT(new_file()) );
  file->insertItem( "Open", this, SLOT(open_file()) );
  file->insertItem( "Merge", this, SLOT(merge_file()) );
  file->insertItem( "Save", this, SLOT(save_file()) );
  file->insertItem( "Save As", this, SLOT(save_as_file()) );
  file->insertSeparator();
  file->insertItem( "Close", this, SLOT(close()) );

  Q3PopupMenu *words = new Q3PopupMenu( this );
  Q_CHECK_PTR( words );

  words->insertItem( "Add word group", this, SLOT(add_group_cb()) );
  words->insertItem( "Delete word group", this, SLOT(delete_group_cb()) );
  words->insertItem( "Change group number", this, SLOT(change_group_number_cb()) );
  words->insertSeparator();
  words->insertItem( "Add word", this, SLOT(add_word_cb()) );
  words->insertItem( "Delete word", this, SLOT(delete_word_cb()) );
  words->insertSeparator();
  words->insertItem( "Count word groups", this, SLOT(count_groups_cb()) );
  words->insertItem( "Count words", this, SLOT(count_words_cb()) );
  words->insertItem( "&Find...", this, SLOT(find_cb()) , Qt::CTRL+Qt::Key_F);


  QMenuBar *menu = new QMenuBar(this);  
  Q_CHECK_PTR( menu );
  menu->insertItem( "File", file );
  menu->insertItem( "Words", words );
  menu->setSeparator( QMenuBar::InWindowsStyle );

  Q3BoxLayout *all =  new Q3VBoxLayout(this,10);

  QSplitter *split = new QSplitter(Qt::Horizontal,this);


  QWidget *left = new QWidget(split);
  Q3BoxLayout *lgroup = new Q3VBoxLayout(left,4);   
  QLabel *labelgroup = new QLabel("Word groups",left,"Word groups");
  labelgroup->setAlignment(Qt::AlignCenter);  
  lgroup->addWidget(labelgroup);
  
  listgroup = new Q3ListBox(left);
  listgroup->setColumnMode (1);
  listgroup->setMinimumSize(200,300);
  connect( listgroup, SIGNAL(highlighted(int)), SLOT(select_group(int)) );
  connect( listgroup, SIGNAL(selected(int)), SLOT(select_group(int)) );

  lgroup->addWidget(listgroup);


  QWidget *right = new QWidget(split);
  Q3BoxLayout *lwords =  new Q3VBoxLayout(right,4);
  labelword = new QLabel("Word group",right,"Word group");
  labelword->setAlignment(Qt::AlignCenter);
  lwords->addWidget(labelword);

  listwords = new Q3ListBox(right);
  listwords->setColumnMode (1);
  listwords->setMinimumSize(200,300);
  connect( listwords, SIGNAL(highlighted(int)), SLOT(select_word(int)) );
  connect( listwords, SIGNAL(selected(int)), SLOT(select_word(int)) );
  lwords->addWidget(listwords);
  
  lineword = new QLineEdit(right);
  lineword->setEnabled(false);
  connect( lineword, SIGNAL(returnPressed()), SLOT(do_add_word()) );
  lwords->addWidget(lineword);  
  

  all->addWidget(split);  

  Q3BoxLayout *buttons =  new Q3HBoxLayout(all,20);

  add_group = new QPushButton("Add group",this);
  connect( add_group, SIGNAL(clicked()), SLOT(add_group_cb()) );
  buttons->addWidget(add_group);

  delete_group = new QPushButton("Delete group",this);
  connect( delete_group, SIGNAL(clicked()), SLOT(delete_group_cb()) );
  buttons->addWidget(delete_group);

  add_word = new QPushButton("Add word",this);
  connect( add_word, SIGNAL(clicked()), SLOT(add_word_cb()) );
  buttons->addWidget(add_word);

  delete_word = new QPushButton("Delete word",this);
  connect( delete_word, SIGNAL(clicked()), SLOT(delete_word_cb()) );
  buttons->addWidget(delete_word);

  Q3BoxLayout *buttons1 =  new Q3HBoxLayout(all,20);

  change_group_number = new QPushButton("&Change group number",this);
  connect( change_group_number, SIGNAL(clicked()), SLOT(change_group_number_cb()) );
  buttons1->addWidget(change_group_number);

  find = new QPushButton("Find",this);
  connect( find, SIGNAL(clicked()), SLOT(find_cb()) );
  buttons1->addWidget(find);
  

  adjustSize();

  changed=false;
  filename="";
  SelectedGroup=0;
  FindLastGroup = FindLastWord = -1;
}
Example #17
0
DrawPad::DrawPad(QWidget* parent, const char* name,  WFlags /*fl*/ )
    : QMainWindow(parent, name, WStyle_ContextHelp)
{
    // init members
    connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)),
             this, SLOT(slotAppMessage(const QCString&, const QByteArray&)) );

    m_pDrawPadCanvas = new DrawPadCanvas(this, this);

    connect(m_pDrawPadCanvas, SIGNAL(pagesChanged()), this, SLOT(updateView()));

    setCentralWidget(m_pDrawPadCanvas);

    // init menu

    setToolBarsMovable(false);

    QToolBar* menuToolBar = new QToolBar(this);
    QMenuBar* menuBar = new QMenuBar(menuToolBar);

    QPopupMenu* toolsPopupMenu = new QPopupMenu(menuBar);

    QAction* deleteAllAction = new QAction(tr("Delete All"), QString::null, 0, this);
    connect(deleteAllAction, SIGNAL(activated()), this, SLOT(deleteAll()));
    deleteAllAction->addTo(toolsPopupMenu);

    toolsPopupMenu->insertSeparator();

    QAction* importPageAction = new QAction(tr("Import"), tr("Import..."), 0, this);
    connect(importPageAction, SIGNAL(activated()), this, SLOT(importPage()));
    importPageAction->addTo(toolsPopupMenu);

    QAction* exportPageAction = new QAction(tr("Export"), tr("Export..."), 0, this);
    connect(exportPageAction, SIGNAL(activated()), this, SLOT(exportPage()));
    exportPageAction->addTo(toolsPopupMenu);

    toolsPopupMenu->insertSeparator();

    QAction* thumbnailViewAction = new QAction(tr("Thumbnail View"), tr("Thumbnail View..."), 0, this);
    connect(thumbnailViewAction, SIGNAL(activated()), this, SLOT(thumbnailView()));
    thumbnailViewAction->addTo(toolsPopupMenu);

    QAction* pageInformationAction = new QAction(tr("Page Information"), tr("Page Information..."), 0, this);
    connect(pageInformationAction, SIGNAL(activated()), this, SLOT(pageInformation()));
    pageInformationAction->addTo(toolsPopupMenu);

    toolsPopupMenu->insertSeparator();

    m_pAntiAliasingAction = new QAction(tr("Anti-Aliasing"), QString::null, 0, this);
    m_pAntiAliasingAction->setToggleAction(true);
    m_pAntiAliasingAction->addTo(toolsPopupMenu);

    menuBar->insertItem(tr("Tools"), toolsPopupMenu);

    // init page toolbar

    QToolBar* pageToolBar = new QToolBar(this);

    QAction* newPageAction = new QAction(tr("New Page"), Opie::Core::OResource::loadPixmap("new", Opie::Core::OResource::SmallIcon),
                                         QString::null, 0, this);
    connect(newPageAction, SIGNAL(activated()), this, SLOT(newPage()));
    newPageAction->addTo(pageToolBar);
    newPageAction->setWhatsThis( tr( "Click here to add a new sheet." ) );

    QAction* clearPageAction = new QAction(tr("Clear Page"),
                                           Opie::Core::OResource::loadPixmap("drawpad/clear", Opie::Core::OResource::SmallIcon),
                                           QString::null, 0, this);
    connect(clearPageAction, SIGNAL(activated()), this, SLOT(clearPage()));
    clearPageAction->addTo(pageToolBar);
    clearPageAction->setWhatsThis( tr( "Click here to erase the current sheet." ) );

    QAction* deletePageAction = new QAction(tr("Delete Page"),
                                            Opie::Core::OResource::loadPixmap("trash", Opie::Core::OResource::SmallIcon),
                                            QString::null, 0, this);
    connect(deletePageAction, SIGNAL(activated()), this, SLOT(deletePage()));
    deletePageAction->addTo(pageToolBar);
    deletePageAction->setWhatsThis( tr( "Click here to remove the current sheet." ) );

    QToolBar* emptyToolBar = new QToolBar(this);
    emptyToolBar->setHorizontalStretchable(true);

    // init navigation toolbar

    QToolBar* navigationToolBar = new QToolBar(this);

    m_pUndoAction = new QAction(tr("Undo"), Opie::Core::OResource::loadPixmap("undo", Opie::Core::OResource::SmallIcon),
                                QString::null, 0, this);
    connect(m_pUndoAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(undo()));
    m_pUndoAction->addTo(navigationToolBar);
    m_pUndoAction->setWhatsThis( tr( "Click here to undo the last action." ) );

    m_pRedoAction = new QAction(tr("Redo"), Opie::Core::OResource::loadPixmap("redo", Opie::Core::OResource::SmallIcon),
                                QString::null, 0, this);
    connect(m_pRedoAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(redo()));
    m_pRedoAction->addTo(navigationToolBar);
    m_pRedoAction->setWhatsThis( tr( "Click here to re-perform the last action." ) );

    m_pFirstPageAction = new QAction(tr("First Page"),
                                     Opie::Core::OResource::loadPixmap("fastback", Opie::Core::OResource::SmallIcon),
                                     QString::null, 0, this);
    connect(m_pFirstPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goFirstPage()));
    m_pFirstPageAction->addTo(navigationToolBar);
    m_pFirstPageAction->setWhatsThis( tr( "Click here to view the first page." ) );

    m_pPreviousPageAction = new QAction(tr("Previous Page"),
                                        Opie::Core::OResource::loadPixmap("back", Opie::Core::OResource::SmallIcon),
                                        QString::null, 0, this);
    connect(m_pPreviousPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goPreviousPage()));
    m_pPreviousPageAction->addTo(navigationToolBar);
    m_pPreviousPageAction->setWhatsThis( tr( "Click here to view the previous page." ) );

    m_pNextPageAction = new QAction(tr("Next Page"),
                                    Opie::Core::OResource::loadPixmap("forward", Opie::Core::OResource::SmallIcon),
                                    QString::null, 0, this);
    connect(m_pNextPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goNextPage()));
    m_pNextPageAction->addTo(navigationToolBar);
    m_pNextPageAction->setWhatsThis( tr( "Click here to view the next page." ) );

    m_pLastPageAction = new QAction(tr("Last Page"),
                                    Opie::Core::OResource::loadPixmap("fastforward", Opie::Core::OResource::SmallIcon),
                                    QString::null, 0, this);
    connect(m_pLastPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goLastPage()));
    m_pLastPageAction->addTo(navigationToolBar);
    m_pLastPageAction->setWhatsThis( tr( "Click here to view the last page." ) );

    // init draw mode toolbar

    QToolBar* drawModeToolBar = new QToolBar(this);

    m_pLineToolButton = new QToolButton(drawModeToolBar);
    m_pLineToolButton->setToggleButton(true);
    QWhatsThis::add( m_pLineToolButton, tr( "Click here to select one of the available tools to draw lines." ) );


    QPopupMenu* linePopupMenu = new QPopupMenu(m_pLineToolButton);

    m_pPointToolAction = new QAction(tr("Draw Point"),
                                     Opie::Core::OResource::loadPixmap("drawpad/point", Opie::Core::OResource::SmallIcon),
                                     "", 0, this);
    connect(m_pPointToolAction, SIGNAL(activated()), this, SLOT(setPointTool()));
    m_pPointToolAction->addTo(linePopupMenu);

    m_pLineToolAction = new QAction(tr("Draw Line"),
                                    Opie::Core::OResource::loadPixmap("drawpad/line", Opie::Core::OResource::SmallIcon),
                                    "", 0, this);
    connect(m_pLineToolAction, SIGNAL(activated()), this, SLOT(setLineTool()));
    m_pLineToolAction->addTo(linePopupMenu);

    m_pLineToolButton->setPopup(linePopupMenu);
    m_pLineToolButton->setPopupDelay(0);

    m_pRectangleToolButton = new QToolButton(drawModeToolBar);
    m_pRectangleToolButton->setToggleButton(true);
    QWhatsThis::add( m_pRectangleToolButton, tr( "Click here to select one of the available tools to draw rectangles." ) );

    QPopupMenu* rectanglePopupMenu = new QPopupMenu(m_pRectangleToolButton);

    m_pRectangleToolAction = new QAction(tr("Draw Rectangle"),
                                         Opie::Core::OResource::loadPixmap("drawpad/rectangle", Opie::Core::OResource::SmallIcon),
                                         "", 0, this);
    connect(m_pRectangleToolAction, SIGNAL(activated()), this, SLOT(setRectangleTool()));
    m_pRectangleToolAction->addTo(rectanglePopupMenu);

    m_pFilledRectangleToolAction = new QAction(tr("Draw Filled Rectangle"),
                                               Opie::Core::OResource::loadPixmap("drawpad/filledrectangle",
                                               Opie::Core::OResource::SmallIcon), "", 0, this);
    connect(m_pFilledRectangleToolAction, SIGNAL(activated()), this, SLOT(setFilledRectangleTool()));
    m_pFilledRectangleToolAction->addTo(rectanglePopupMenu);

    m_pRectangleToolButton->setPopup(rectanglePopupMenu);
    m_pRectangleToolButton->setPopupDelay(0);

    m_pEllipseToolButton = new QToolButton(drawModeToolBar);
    m_pEllipseToolButton->setToggleButton(true);
    QWhatsThis::add( m_pEllipseToolButton, tr( "Click here to select one of the available tools to draw ellipses." ) );

    QPopupMenu* ellipsePopupMenu = new QPopupMenu(m_pEllipseToolButton);

    m_pEllipseToolAction = new QAction(tr("Draw Ellipse"),
                                       Opie::Core::OResource::loadPixmap("drawpad/ellipse", Opie::Core::OResource::SmallIcon),
                                       "", 0, this);
    connect(m_pEllipseToolAction, SIGNAL(activated()), this, SLOT(setEllipseTool()));
    m_pEllipseToolAction->addTo(ellipsePopupMenu);

    m_pFilledEllipseToolAction = new QAction(tr("Draw Filled Ellipse"),
                                             Opie::Core::OResource::loadPixmap("drawpad/filledellipse",
                                             Opie::Core::OResource::SmallIcon), "", 0, this);
    connect(m_pFilledEllipseToolAction, SIGNAL(activated()), this, SLOT(setFilledEllipseTool()));
    m_pFilledEllipseToolAction->addTo(ellipsePopupMenu);

    m_pEllipseToolButton->setPopup(ellipsePopupMenu);
    m_pEllipseToolButton->setPopupDelay(0);

    m_pTextToolAction = new QAction(tr("Insert Text"),
                                    Opie::Core::OResource::loadPixmap("drawpad/text", Opie::Core::OResource::SmallIcon),
                                    QString::null, 0, this);
    m_pTextToolAction->setToggleAction(true);
    connect(m_pTextToolAction, SIGNAL(activated()), this, SLOT(setTextTool()));
    m_pTextToolAction->addTo(drawModeToolBar);
    m_pTextToolAction->setWhatsThis( tr( "Click here to select the text drawing tool." ) );

    m_pFillToolAction = new QAction(tr("Fill Region"),
                                    Opie::Core::OResource::loadPixmap("drawpad/fill", Opie::Core::OResource::SmallIcon),
                                    QString::null, 0, this);
    m_pFillToolAction->setToggleAction(true);
    connect(m_pFillToolAction, SIGNAL(activated()), this, SLOT(setFillTool()));
    m_pFillToolAction->addTo(drawModeToolBar);
    m_pFillToolAction->setWhatsThis( tr( "Click here to select the fill tool." ) );

    m_pEraseToolAction = new QAction(tr("Erase Point"),
                                     Opie::Core::OResource::loadPixmap("drawpad/erase", Opie::Core::OResource::SmallIcon),
                                     QString::null, 0, this);
    m_pEraseToolAction->setToggleAction(true);
    connect(m_pEraseToolAction, SIGNAL(activated()), this, SLOT(setEraseTool()));
    m_pEraseToolAction->addTo(drawModeToolBar);
    m_pEraseToolAction->setWhatsThis( tr( "Click here to select the eraser tool." ) );

    m_pTool = 0;
    setRectangleTool();
    setEllipseTool();
    setPointTool();

    emptyToolBar = new QToolBar(this);
    emptyToolBar->setHorizontalStretchable(true);
    emptyToolBar->addSeparator();

    // init draw parameters toolbar

    QToolBar* drawParametersToolBar = new QToolBar(this);

    m_pPenWidthSpinBox = new QSpinBox(1, 9, 1, drawParametersToolBar);
    connect(m_pPenWidthSpinBox, SIGNAL(valueChanged(int)), this, SLOT(changePenWidth(int)));

    QToolTip::add(m_pPenWidthSpinBox, tr("Pen Width"));
    m_pPenWidthSpinBox->setValue(1);
    m_pPenWidthSpinBox->setFocusPolicy(QWidget::NoFocus);
    QWhatsThis::add( m_pPenWidthSpinBox, tr( "Click here to select the width of the drawing pen." ) );

    bool useBigIcon = qApp->desktop()->size().width() > 330;

    m_pPenColorToolButton = new QToolButton(drawParametersToolBar);
    m_pPenColorToolButton->setUsesBigPixmap( useBigIcon );
    m_pPenColorToolButton->setPixmap(Opie::Core::OResource::loadPixmap("drawpad/pencolor", Opie::Core::OResource::SmallIcon));
    QWhatsThis::add( m_pPenColorToolButton, tr( "Click here to select the color used when drawing." ) );

    Opie::OColorPopupMenu* penColorPopupMenu = new Opie::OColorPopupMenu(Qt::black, m_pPenColorToolButton);
    connect(penColorPopupMenu, SIGNAL(colorSelected(const QColor&)), this, SLOT(changePenColor(const QColor&)));

    QToolTip::add(m_pPenColorToolButton, tr("Pen Color"));
    m_pPenColorToolButton->setPopup(penColorPopupMenu);
    m_pPenColorToolButton->setPopupDelay(0);

    changePenColor(Qt::black);

    m_pBrushColorToolButton = new QToolButton(drawParametersToolBar);
    m_pBrushColorToolButton->setUsesBigPixmap( useBigIcon );
    m_pBrushColorToolButton->setPixmap(Opie::Core::OResource::loadPixmap("drawpad/brushcolor", Opie::Core::OResource::SmallIcon));
    QWhatsThis::add( m_pBrushColorToolButton, tr( "Click here to select the color used when filling in areas." ) );

    Opie::OColorPopupMenu* brushColorPopupMenu = new Opie::OColorPopupMenu(Qt::white, m_pBrushColorToolButton);
    connect(brushColorPopupMenu, SIGNAL(colorSelected(const QColor&)), this, SLOT(changeBrushColor(const QColor&)));

    QToolTip::add(m_pBrushColorToolButton, tr("Fill Color"));
    m_pBrushColorToolButton->setPopup(brushColorPopupMenu);
    m_pBrushColorToolButton->setPopupDelay(0);

    changeBrushColor(Qt::white);

    // delay the rest of the initialization and do it from within the mainloop
    // if we don't do this, the widget layout may not be constructed upon
    // and we will end up with a wrong QScrollview page size (Mickeyl)
    QTimer::singleShot( 100, this, SLOT( finishStartup() ) );
}
Example #18
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();

}
Example #19
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();
}
Example #20
0
void QucsHelp::setupActions()
{
  QToolBar *toolbar = new QToolBar(this,"main_toolbar");

  this->addToolBar(toolbar);

  QMenuBar *bar = menuBar();

  const QKeySequence ks = QKeySequence();

  QAction *quitAction = new QAction(QIcon((":/bitmaps/quit.png")),
                                    tr("&Quit"), (const QKeySequence&)Qt::CTRL+Qt::Key_Q, this,"");
  QAction *backAction = new QAction(QIcon((":/bitmaps/back.png")),
                                    tr("&Back"), Qt::ALT+Qt::Key_Left, this,"");
  QAction *forwardAction = new QAction(QIcon((":/bitmaps/forward.png")),
                                       tr("&Forward"), Qt::ALT+Qt::Key_Right, this,"");
  QAction *homeAction = new QAction(QIcon((":/bitmaps/home.png")),
                                    tr("&Home"),Qt::CTRL+Qt::Key_H,this,"");
  previousAction = new QAction(QIcon((":/bitmaps/previous.png")),tr("&Previous"),
                               ks, this,"");
  nextAction = new QAction(QIcon((":/bitmaps/next.png")),
                           tr("&Next"), ks, this,"");
  viewBrowseDock = new QAction(tr("&Table of Contents"), 0, this,"");
  viewBrowseDock->setToggleAction(true);
  viewBrowseDock->setOn(true);
  viewBrowseDock->setStatusTip(tr("Enables/disables the table of contents"));
  viewBrowseDock->setWhatsThis(tr("Table of Contents\n\nEnables/disables the table of contents"));

  connect(quitAction,SIGNAL(activated()),qApp,SLOT(quit()));

  connect(backAction,SIGNAL(activated()),textBrowser,SLOT(backward()));
  connect(textBrowser,SIGNAL(backwardAvailable(bool)),backAction,SLOT(setEnabled(bool)));

  connect(forwardAction,SIGNAL(activated()),textBrowser,SLOT(forward()));
  connect(textBrowser,SIGNAL(forwardAvailable(bool)),forwardAction,SLOT(setEnabled(bool)));

  connect(homeAction,SIGNAL(activated()),textBrowser,SLOT(home()));
  connect(homeAction,SIGNAL(activated()),this,SLOT(gohome()));

  connect(textBrowser,SIGNAL(sourceChanged(const QUrl &)),this,SLOT(slotSourceChanged(const QUrl &)));
  connect(previousAction,SIGNAL(activated()),this,SLOT(previousLink()));
  connect(nextAction,SIGNAL(activated()),this,SLOT(nextLink()));
  connect(viewBrowseDock, SIGNAL(toggled(bool)), SLOT(slotToggleSidebar(bool)));

  backAction->addTo(toolbar);
  forwardAction->addTo(toolbar);
  toolbar->addSeparator();
  homeAction->addTo(toolbar);
  previousAction->addTo(toolbar);
  nextAction->addTo(toolbar);
  toolbar->addSeparator();
  quitAction->addTo(toolbar);

  QMenu *fileMenu = new QMenu(this);
  quitAction->addTo(fileMenu);

  QMenu *viewMenu = new QMenu(this);
  backAction->addTo(viewMenu);
  forwardAction->addTo(viewMenu);
  homeAction->addTo(viewMenu);
  previousAction->addTo(viewMenu);
  nextAction->addTo(viewMenu);
  viewMenu->insertSeparator();
  viewBrowseDock->addTo(viewMenu);

  QMenu *helpMenu = new QMenu(this);
  helpMenu->insertItem(tr("&About Qt"),qApp,SLOT(aboutQt()));

  bar->insertItem(tr("&File"), fileMenu );
  bar->insertItem(tr("&View"),viewMenu);
  bar->insertSeparator();
  bar->insertItem(tr("&Help"),helpMenu);
}
Example #21
0
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();
}
Example #22
0
/* Constructor setups the GUI. */
QucsLib::QucsLib()
{
  // set application icon
  setIcon (QPixmap(QucsSettings.BitmapDir + "big.qucs.xpm"));
  setCaption("Qucs Library Tool " PACKAGE_VERSION);

  QMenuBar * menuBar = new QMenuBar (this);

  // create file menu
  QPopupMenu * fileMenu = new QPopupMenu ();
  QAction * manageLib =
    new QAction ("Manage User Libraries...", tr("Manage User &Libraries..."), CTRL+Key_M, this);
  manageLib->addTo (fileMenu);
  connect(manageLib, SIGNAL(activated()), SLOT(slotManageLib()));

  fileMenu->insertSeparator();

  QAction * fileQuit =
    new QAction ("Quit", tr("&Quit"), CTRL+Key_Q, this);
  fileQuit->addTo (fileMenu);
  connect(fileQuit, SIGNAL(activated()), SLOT(slotQuit()));

  // create help menu
  QPopupMenu * helpMenu = new QPopupMenu ();
  QAction * helpHelp =
    new QAction (tr("Help"), tr("&Help"), Key_F1, this);
  helpHelp->addTo (helpMenu);
  connect(helpHelp, SIGNAL(activated()), SLOT(slotHelp()));
  QAction * helpAbout =
    new QAction (tr("About"), tr("About"), 0, helpMenu);
  helpAbout->addTo (helpMenu);
  connect(helpAbout, SIGNAL(activated()), SLOT(slotAbout()));

  // setup menu bar
  menuBar->insertItem (tr("&File"), fileMenu);
  menuBar->insertSeparator ();
  menuBar->insertItem (tr("&Help"), helpMenu);

  // main box
  QVBoxLayout * all = new QVBoxLayout (this);
  all->setSpacing (0);
  all->setMargin (0);

  // reserve space for menubar
  QWidget * Space = new QWidget (this);
  Space->setFixedSize(5, menuBar->height() + 2);
  all->addWidget (Space);

  // main layout
  QHBox * h = new QHBox (this);
  h->setSpacing (5);
  h->setMargin (3);
  all->addWidget (h);

  // library and component choice
  QVGroupBox * LibGroup = new QVGroupBox (tr("Component Selection"), h);
  Library = new QComboBox (LibGroup);
  connect(Library, SIGNAL(activated(int)), SLOT(slotSelectLibrary(int)));
  CompList = new QListBox(LibGroup);
  connect(CompList, SIGNAL(highlighted(QListBoxItem*)),
	SLOT(slotShowComponent(QListBoxItem*)));

  QHBox * h1 = new QHBox (LibGroup);
  QPushButton * SearchButton = new QPushButton (tr("Search..."), h1);
  connect(SearchButton, SIGNAL(clicked()), SLOT(slotSearchComponent()));
  h1->setStretchFactor(new QWidget(h1), 5); // stretchable placeholder


  // component display
  QVGroupBox *CompGroup = new QVGroupBox (tr("Component"), h);
  CompDescr = new QTextEdit(CompGroup);
  CompDescr->setTextFormat(Qt::PlainText);
  CompDescr->setReadOnly(true);
  CompDescr->setWordWrap(QTextEdit::NoWrap);

  Symbol = new SymbolWidget (CompGroup);

  QHBox * h2 = new QHBox (CompGroup);
  QPushButton * CopyButton = new QPushButton (tr("Copy to clipboard"), h2);
  connect(CopyButton, SIGNAL(clicked()), SLOT(slotCopyToClipBoard()));
  QPushButton * ShowButton = new QPushButton (tr("Show Model"), h2);
  connect(ShowButton, SIGNAL(clicked()), SLOT(slotShowModel()));

  // ......................................................
  putLibrariesIntoCombobox();
}
Example #23
0
FileManager::FileManager(QWidget * parent , const char * name , WFlags f ):QMainWindow(parent,name,f)
{

  QVBoxLayout *layout = new QVBoxLayout( this );
  layout->setSpacing(2);
  layout->setMargin(2);

  h_box_ = new QHBox(this);
  dirtree_view_ = new DirTreeView(h_box_);
  //dirtree_view_->hide();
  dir_content_ = new DirContent(h_box_);
  //dir_content_->hide();
  //image_widget_ = new ImageWidget(h_box_);
  //setCentralWidget(h_box_);
  font_selector_ = new FontSelector();

  dirtree_view_->setGeometry(0,0,width(),height()*2);
  dir_content_->setGeometry(width(),0,width(),height()*2);
  //image_widget_->setGeometry(0,0,width(),height()*3);

  le_on_dirtree_ = new RenameLineEdit(dirtree_view_);
  le_on_dirtree_ -> hide();

  le_on_dir_content_ = new RenameLineEdit(dir_content_);
  le_on_dir_content_ -> hide();

  connect(le_on_dirtree_, SIGNAL( lost_focus() ), SLOT( rename() ) );
  connect(le_on_dirtree_, SIGNAL(returnPressed()), this, SLOT(rename()));

  connect(le_on_dir_content_, SIGNAL( lost_focus() ), SLOT( rename() ) );
  connect(le_on_dir_content_, SIGNAL(returnPressed()), this, SLOT(rename()));




  QObject::connect(dirtree_view_, SIGNAL(clicked ( QListViewItem *) ), dir_content_, SLOT(get_content(QListViewItem *) ));

  connect(dirtree_view_,SIGNAL(currentChanged ( QListViewItem *)), dir_content_, SLOT(get_content(QListViewItem *) ) );

  QObject::connect(dir_content_, SIGNAL(cur_dir ( const std::string &) ), this, SLOT(modify_caption(const std::string &) ));

  QMenuBar *menubar = new QMenuBar(this);
  //QPEToolBar* toolBar = new QPEToolBar( this );
  //toolBar->setHorizontalStretchable( TRUE );


  //QPEMenuBar* menuBar = new QPEMenuBar( toolBar );

  //layout->addWidget(toolBar);
  layout->addWidget(menubar);


  file_ = new QPopupMenu( this );  
  menubar->insertItem( tr( "File" ), file_ );

  INIT_FO_POPUP(file_, this);


  view_ = new QPopupMenu( this );  

  menubar->insertItem( tr( "View" ), view_ );

  view_->insertItem(tr("status bar"),this, SLOT(show_status_bar()));
  //view_->setCheckable(true);
  view_->setItemChecked(view_->idAt(0),false);

  options_ = new QPopupMenu( this );  
  menubar->insertItem( tr( "Options" ), options_ );
  options_->insertItem("Font",this, SLOT(select_font()));

  up_ = new QToolButton(0,"up");
  left_ = new QToolButton(0,"left");  
  right_ = new QToolButton(0,"right"); 

  init_tool_button(menubar,up_,"up.png");
  init_tool_button(menubar,left_,"left.png");
  init_tool_button(menubar,right_,"right.png");
   
  connect(up_, SIGNAL(clicked() ) , this, SLOT(cd_up()));
  connect(left_, SIGNAL(clicked() ) , this, SLOT(screen_off()));
  connect(right_, SIGNAL(clicked() ) , this, SLOT(screen_on()));

  QHBox *line_box = new QHBox( this );
  layout->addWidget(line_box);

  layout->addWidget(h_box_);

  select_dir_ = new QComboBox(line_box);
  select_dir_->insertItem("/");
  select_dir_->insertItem("/home/");
  select_dir_->insertItem("/etc/");
  select_dir_->insertItem("/mnt");
  select_dir_->insertItem("/root");
  select_dir_->insertItem("/home/descent/12/");
  select_dir_->insertItem("/home/descent/aaa/");

  connect(select_dir_, SIGNAL(activated ( const QString &) ), this, SLOT(change_dirtreeview_item(const QString & )) );

  connect(dir_content_, SIGNAL( opendir ( const std::string &) ), this, SLOT(change_dirtreeview_item(const std::string & )) );

  status_bar_ = statusBar ();


  if (status_bar_!=0)
  {
    qDebug("have status bar");
    layout->addWidget(status_bar_);
  }
  else
    qDebug("don't have status bar");
  //status_bar = new QStatusBar(this);
//#endif
}
Example #24
0
void MainWindow::initUI()
{
    // Build menu and tool bars
    setToolBarsMovable( false );

    m_menuBar.setHorizontalStretchable( true );
    QMenuBar *mb = new QMenuBar( &m_menuBar );
    mb->setMargin( 0 );

    // Find toolbar
    addToolBar( &m_findBar, QMainWindow::Top, true );
    m_findBar.setHorizontalStretchable( true );
    m_findEdit = new QLineEdit( &m_findBar );
    QWhatsThis::add( m_findEdit, tr( "Type the text to search for here." ) );
    m_findBar.setStretchableWidget( m_findEdit );
    connect( m_findEdit, SIGNAL(textChanged(const QString&)), this, SLOT(slotFindChanged(const QString&)) );

    // Packages menu
    QPopupMenu *popup = new QPopupMenu( this );

    QAction *a = new QAction( tr( "Update lists" ), Opie::Core::OResource::loadPixmap( "packagemanager/update",
                              Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 );
    a->setWhatsThis( tr( "Tap here to update package lists from servers." ) );
    connect( a, SIGNAL(activated()), this, SLOT(slotUpdate()) );
    a->addTo( popup );
    a->addTo( &m_toolBar );

    QAction *actionUpgrade = new QAction( tr( "Upgrade" ), Opie::Core::OResource::loadPixmap( "packagemanager/upgrade",
                                          Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 );
    actionUpgrade->setWhatsThis( tr( "Tap here to upgrade all installed packages if a newer version is available." ) );
    connect( actionUpgrade, SIGNAL(activated()), this, SLOT(slotUpgrade()) );
    actionUpgrade->addTo( popup );
    actionUpgrade->addTo( &m_toolBar );

    QPixmap iconDownload = Opie::Core::OResource::loadPixmap( "packagemanager/download", Opie::Core::OResource::SmallIcon );
    QPixmap iconRemove = Opie::Core::OResource::loadPixmap( "packagemanager/remove", Opie::Core::OResource::SmallIcon );
    QAction *actionDownload = new QAction( tr( "Download" ), iconDownload, QString::null, 0, this, 0 );
    actionDownload->setWhatsThis( tr( "Tap here to download the currently selected package(s)." ) );
    connect( actionDownload, SIGNAL(activated()), this, SLOT(slotDownload()) );
#ifndef USE_LIBOPKG
    actionDownload->addTo( popup );
    actionDownload->addTo( &m_toolBar );
#endif

    a = new QAction( tr( "Apply changes" ), Opie::Core::OResource::loadPixmap( "packagemanager/apply",
                     Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 );
    a->setWhatsThis( tr( "Tap here to install, remove or upgrade currently selected package(s)." ) );
    connect( a, SIGNAL(activated()), this, SLOT(slotApply()) );
    a->addTo( popup );
    a->addTo( &m_toolBar );

    a = new QAction( tr( "Install local package" ), Opie::Core::OResource::loadPixmap( "folder",
                     Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 );
    a->setWhatsThis( tr( "Tap here to install a package file located on device." ) );
    connect( a, SIGNAL(activated()), this, SLOT(slotInstallLocal()) );
    a->addTo( popup );
    //a->addTo( &m_toolBar );

    popup->insertSeparator();

    a = new QAction( tr( "Configure" ), Opie::Core::OResource::loadPixmap( "SettingsIcon",
                     Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 );
    a->setWhatsThis( tr( "Tap here to configure this application." ) );
    connect( a, SIGNAL(activated()), this, SLOT(slotConfigure()) );
    a->addTo( popup );
    mb->insertItem( tr( "Actions" ), popup );

    // View menu
    popup = new QPopupMenu( this );

    m_actionShowNotInstalled = new QAction( tr( "Show packages not installed" ), QString::null, 0, this, 0 );
    m_actionShowNotInstalled->setToggleAction( true );
    m_actionShowNotInstalled->setWhatsThis( tr( "Tap here to show packages available which have not been installed." ) );
    connect( m_actionShowNotInstalled, SIGNAL(activated()), this, SLOT(slotShowNotInstalled()) );
    m_actionShowNotInstalled->addTo( popup );

    m_actionShowInstalled = new QAction( tr( "Show installed packages" ), QString::null, 0, this, 0 );
    m_actionShowInstalled->setToggleAction( true );
    m_actionShowInstalled->setWhatsThis( tr( "Tap here to show packages currently installed on this device." ) );
    connect( m_actionShowInstalled, SIGNAL(activated()), this, SLOT(slotShowInstalled()) );
    m_actionShowInstalled->addTo( popup );

    m_actionShowUpdated = new QAction( tr( "Show updated packages" ), QString::null, 0, this, 0 );
    m_actionShowUpdated->setToggleAction( true );
    m_actionShowUpdated->setWhatsThis( tr( "Tap here to show packages currently installed on this device which have a newer version available." ) );
    connect( m_actionShowUpdated, SIGNAL(activated()), this, SLOT(slotShowUpdated()) );
    m_actionShowUpdated->addTo( popup );

    popup->insertSeparator();

    m_actionFilter = new QAction( tr( "Filter" ), Opie::Core::OResource::loadPixmap( "packagemanager/filter",
                                  Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 );
    m_actionFilter->setToggleAction( true );
    m_actionFilter->setWhatsThis( tr( "Tap here to apply current filter." ) );
    connect( m_actionFilter, SIGNAL(toggled(bool)), this, SLOT(slotFilter(bool)) );
    m_actionFilter->addTo( popup );

    a = new QAction( tr( "Filter settings" ),  QString::null, 0, this, 0 );
    a->setWhatsThis( tr( "Tap here to change the package filter criteria." ) );
    connect( a, SIGNAL(activated()), this, SLOT(slotFilterChange()) );
    a->addTo( popup );

    popup->insertSeparator();

    a = new QAction( tr( "Find" ), Opie::Core::OResource::loadPixmap( "find", Opie::Core::OResource::SmallIcon ),
                     QString::null, 0, this, 0 );
    a->setWhatsThis( tr( "Tap here to search for text in package names." ) );
    connect( a, SIGNAL(activated()), this, SLOT(slotFindShowToolbar()) );
    a->addTo( popup );

    m_actionFindNext = new QAction( tr( "Find next" ), Opie::Core::OResource::loadPixmap( "next",
                                    Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 );
    m_actionFindNext->setEnabled( false );
    m_actionFindNext->setWhatsThis( tr( "Tap here to find the next package name containing the text you are searching for." ) );
    connect( m_actionFindNext, SIGNAL(activated()), this, SLOT(slotFindNext()) );
    m_actionFindNext->addTo( popup );
    m_actionFindNext->addTo( &m_findBar );

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

    // Finish find toolbar creation
    a = new QAction( QString::null, Opie::Core::OResource::loadPixmap( "close", Opie::Core::OResource::SmallIcon ),
                     QString::null, 0, this, 0 );
    a->setWhatsThis( tr( "Tap here to hide the find toolbar." ) );
    connect( a, SIGNAL(activated()), this, SLOT(slotFindHideToolbar()) );
    a->addTo( &m_findBar );
    m_findBar.hide();
}
Example #25
0
FilterDialog::FilterDialog (QWidget * parent) : QDialog (parent)
{
  // set application icon
  ///setIcon (QPixmap(QucsSettings.BitmapDir + "big.qucs.xpm"));
  setCaption("Qucs Filter " PACKAGE_VERSION);

  all = new Q3VBoxLayout(this);

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

  Q3PopupMenu *helpMenu = new Q3PopupMenu();
  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);
  Q3GridLayout *gp1 = new Q3GridLayout(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);
  Q3HBox *h1 = new Q3HBox(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 Q3VButtonGroup(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 Q3VButtonGroup(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)
  Q3HBox *Butts = new Q3HBox(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() ) );
}
Example #26
0
TxqPlot3DWindow::TxqPlot3DWindow( char *thisLabel, WindowType myWindow )
    : QWidget( )
{

    // set thisWindow so that all class members may access
    thisWindow = myWindow;

    // Set the title
    setPalette( QPalette( Qt::lightGray ) );
    setCaption(thisLabel);
    setIconText(thisLabel);

    // Create top-level layout manager
    QHBoxLayout* hlayout = new QHBoxLayout( this, 20, 20, "hlayout");

    // Create a popup menu containing Close
    QPopupMenu *file = new QPopupMenu();
    file->setPalette( QPalette( Qt::lightGray ) );
    file->insertItem( "Close",  this, SLOT( close() ), CTRL+Key_Q );

    // Create a menu bar
    QMenuBar *m = new QMenuBar( this );
    m->setSeparator( QMenuBar::InWindowsStyle );
    m->insertItem("&File", file );
    hlayout->setMenuBar( m );

    // Create a layout manager for the sliders
    QVBoxLayout* vlayout = new QVBoxLayout( 20, "vlayout");
    hlayout->addLayout( vlayout );

    // Create a nice frame tp put around the openGL widget
    QFrame* f = new QFrame( this, "frame" );
    f->setFrameStyle( QFrame::Sunken | QFrame::Panel );
    f->setLineWidth( 2 );
    hlayout->addWidget( f, 1 );

    // Create a layout manager for the openGL widget
    QHBoxLayout* flayout = new QHBoxLayout( f, 2, 2, "flayout");

    // Create an openGL widget
    plot3D = new GLPlot3D( f, "glbox");
    plot3D->setData(thisLabel, myWindow);
    plot3D->setMinimumSize( 50, 50 );
    flayout->addWidget( plot3D, 1 );
    flayout->activate();

    // Create the three sliders; one for each rotation axis
    QSlider* x = new QSlider ( 0, 360, 60, 0, QSlider::Vertical, this, "xsl" );
    x->setTickmarks( QSlider::Left );
    x->setMinimumSize( x->sizeHint() );
    vlayout->addWidget( x );
    QObject::connect( x, SIGNAL(valueChanged(int)),plot3D,SLOT(setXRotation(int)) );

    QSlider* y = new QSlider ( 0, 360, 60, 0, QSlider::Vertical, this, "ysl" );
    y->setTickmarks( QSlider::Left );
    y->setMinimumSize( y->sizeHint() );
    vlayout->addWidget( y );
    QObject::connect( y, SIGNAL(valueChanged(int)),plot3D,SLOT(setYRotation(int)) );

    QSlider* z = new QSlider ( 0, 360, 60, 0, QSlider::Vertical, this, "zsl" );
    z->setTickmarks( QSlider::Left );
    z->setMinimumSize( z->sizeHint() );
    vlayout->addWidget( z );
    QObject::connect( z, SIGNAL(valueChanged(int)),plot3D,SLOT(setZRotation(int)) );

    // create the slider for the eye translation
    QSlider* t = new QSlider ( -15, -5, 1, -15, QSlider::Vertical, this, "tsl" );
    t->setTickmarks( QSlider::Left );
    t->setMinimumSize( x->sizeHint() );
    vlayout->addWidget( t );
    QObject::connect( t, SIGNAL(valueChanged(int)),plot3D,SLOT(setTranslation(int)) );

    // Start the geometry management
    hlayout->activate();
}
Example #27
0
GLObjectWindow::GLObjectWindow( QWidget* parent, const char* name )
    : QWidget( parent, name )
{
    // Create a menu
    file = new QPopupMenu( this );
    file->setCheckable( TRUE );
    file->insertItem( "Grab Frame Buffer", this, SLOT(grabFrameBuffer()) );
    file->insertItem( "Render Pixmap", this, SLOT(makePixmap()) );
    file->insertItem( "Render Pixmap Hidden", this, SLOT(makePixmapHidden()) );
    file->insertSeparator();
    fixMenuItemId = file->insertItem( "Use Fixed Pixmap Size", this, 
				      SLOT(useFixedPixmapSize()) );
    file->insertSeparator();
    insertMenuItemId = file->insertItem( "Insert Pixmap Here", this, 
					 SLOT(makePixmapForMenu()) );
    file->insertSeparator();
    file->insertItem( "Exit",  qApp, SLOT(quit()), CTRL+Key_Q );

    // Create a menu bar
    QMenuBar *m = new QMenuBar( this );
    m->setSeparator( QMenuBar::InWindowsStyle );
    m->insertItem("&File", file );

    // Create nice frames to put around the OpenGL widgets
    QFrame* f1 = new QFrame( this, "frame1" );
    f1->setFrameStyle( QFrame::Sunken | QFrame::Panel );
    f1->setLineWidth( 2 );

    // Create an OpenGL widget
    c1 = new GLBox( f1, "glbox1");

    // Create a label that can display the pixmap
    lb = new QLabel( this, "pixlabel" );
    lb->setFrameStyle( QFrame::Sunken | QFrame::Panel );
    lb->setLineWidth( 2 );
    lb->setAlignment( AlignCenter );
    lb->setMargin( 0 );
    lb->setIndent( 0 );

    // Create the three sliders; one for each rotation axis
    QSlider* x = new QSlider ( 0, 360, 60, 0, QSlider::Vertical, this, "xsl" );
    x->setTickmarks( QSlider::Left );
    connect( x, SIGNAL(valueChanged(int)), c1, SLOT(setXRotation(int)) );

    QSlider* y = new QSlider ( 0, 360, 60, 0, QSlider::Vertical, this, "ysl" );
    y->setTickmarks( QSlider::Left );
    connect( y, SIGNAL(valueChanged(int)), c1, SLOT(setYRotation(int)) );

    QSlider* z = new QSlider ( 0, 360, 60, 0, QSlider::Vertical, this, "zsl" );
    z->setTickmarks( QSlider::Left );
    connect( z, SIGNAL(valueChanged(int)), c1, SLOT(setZRotation(int)) );


    // Now that we have all the widgets, put them into a nice layout

    // Put the sliders on top of each other
    QVBoxLayout* vlayout = new QVBoxLayout( 20, "vlayout");
    vlayout->addWidget( x );
    vlayout->addWidget( y );
    vlayout->addWidget( z );

    // Put the GL widget inside the frame
    QHBoxLayout* flayout1 = new QHBoxLayout( f1, 2, 2, "flayout1");
    flayout1->addWidget( c1, 1 );

    // Top level layout, puts the sliders to the left of the frame/GL widget
    QHBoxLayout* hlayout = new QHBoxLayout( this, 20, 20, "hlayout");
    hlayout->setMenuBar( m );
    hlayout->addLayout( vlayout );
    hlayout->addWidget( f1, 1 );
    hlayout->addWidget( lb, 1 );

}
Example #28
0
GLObjectWindow::GLObjectWindow( QWidget* parent, const char* name )
    : QWidget( parent, name )
{
    // Create top-level layout manager
    QHBoxLayout* hlayout = new QHBoxLayout( this, 20, 20, "hlayout");

    // Create a menu
    QPopupMenu *file = new QPopupMenu();
    file->insertItem( "Delete Left QGLWidget", this, 
		      SLOT(deleteFirstWidget()) );
    file->insertItem( "Exit",  qApp, SLOT(quit()), CTRL+Key_Q );

    // Create a menu bar
    QMenuBar *m = new QMenuBar( this );
    m->setSeparator( QMenuBar::InWindowsStyle );
    m->insertItem("&File", file );
    hlayout->setMenuBar( m );

    // Create a layout manager for the sliders
    QVBoxLayout* vlayout = new QVBoxLayout( 20, "vlayout");
    hlayout->addLayout( vlayout );

    // Create a nice frame to put around the openGL widget
    QFrame* f = new QFrame( this, "frame" );
    f->setFrameStyle( QFrame::Sunken | QFrame::Panel );
    f->setLineWidth( 2 );
    hlayout->addWidget( f, 1 );

    // Create a layout manager for the openGL widget
    QHBoxLayout* flayout = new QHBoxLayout( f, 2, 2, "flayout");


    // Create an openGL widget
    c1 = new GLBox( f, "glbox1");
    c1->setMinimumSize( 50, 50 );
    flayout->addWidget( c1, 1 );
    flayout->activate();


    // Create a nice frame to put around the second openGL widget
    QFrame* f2 = new QFrame( this, "frame2" );
    f2->setFrameStyle( QFrame::Sunken | QFrame::Panel );
    f2->setLineWidth( 2 );
    hlayout->addWidget( f2, 1 );

    // Create a layout manager for the second openGL widget
    QHBoxLayout* flayout2 = new QHBoxLayout( f2, 2, 2, "flayout2");

    // Create another openGL widget which shares display lists with the first
    c2 = new GLBox( f2, "glbox2", c1 );
    c2->setMinimumSize( 50, 50 );
    flayout2->addWidget( c2, 1 );
    flayout2->activate();

    // Create the three sliders; one for each rotation axis
    QSlider* x = new QSlider ( 0, 360, 60, 0, QSlider::Vertical, this, "xsl" );
    x->setTickmarks( QSlider::Left );
    x->setMinimumSize( x->sizeHint() );
    vlayout->addWidget( x );
    QObject::connect( x, SIGNAL(valueChanged(int)),c1,SLOT(setXRotation(int)));
    QObject::connect( x, SIGNAL(valueChanged(int)),c2,SLOT(setZRotation(int)));

    QSlider* y = new QSlider ( 0, 360, 60, 0, QSlider::Vertical, this, "ysl" );
    y->setTickmarks( QSlider::Left );
    y->setMinimumSize( y->sizeHint() );
    vlayout->addWidget( y );
    QObject::connect( y, SIGNAL(valueChanged(int)),c1,SLOT(setYRotation(int)));
    QObject::connect( y, SIGNAL(valueChanged(int)),c2,SLOT(setXRotation(int)));

    QSlider* z = new QSlider ( 0, 360, 60, 0, QSlider::Vertical, this, "zsl" );
    z->setTickmarks( QSlider::Left );
    z->setMinimumSize( z->sizeHint() );
    vlayout->addWidget( z );
    QObject::connect( z, SIGNAL(valueChanged(int)),c1,SLOT(setZRotation(int)));
    QObject::connect( z, SIGNAL(valueChanged(int)),c2,SLOT(setYRotation(int)));

    // Start the geometry management
    hlayout->activate();
}
Example #29
0
TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f )
    : QMainWindow( parent, name, f )
{
    doc = 0;
    edited=false;

    setToolBarsMovable( false );
    connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );

    channel = new QCopChannel( "QPE/Application/textedit", this );
    connect( channel, SIGNAL(received(const QCString&,const QByteArray&)),
        this, SLOT(receive(const QCString&,const QByteArray&)) );

    setIcon( Opie::Core::OResource::loadPixmap( "textedit/TextEditor", Opie::Core::OResource::SmallIcon ) );

    QToolBar *bar = new QToolBar( this );
    bar->setHorizontalStretchable( true );
    menu = bar;

    QMenuBar *mb = new QMenuBar( bar );
    QPopupMenu *file = new QPopupMenu( this );
    QPopupMenu *edit = new QPopupMenu( this );
    QPopupMenu *advancedMenu = new QPopupMenu(this);

    font = new QPopupMenu( this );

    bar = new QToolBar( this );
    editBar = bar;

    QAction *a = new QAction( tr( "New" ), Opie::Core::OResource::loadPixmap( "new", Opie::Core::OResource::SmallIcon ),
                              QString::null, 0, this, 0 );
    connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) );
//    a->addTo( bar );
    a->addTo( file );

    a = new QAction( tr( "Open" ), Opie::Core::OResource::loadPixmap( "fileopen", Opie::Core::OResource::SmallIcon ),
                     QString::null, 0, this, 0 );
    connect( a, SIGNAL( activated() ), this, SLOT( fileOpen() ) );
    a->addTo( bar );
    a->addTo( file );

    a = new QAction( tr( "Save" ), Opie::Core::OResource::loadPixmap( "save", Opie::Core::OResource::SmallIcon ),
                     QString::null, 0, this, 0 );
    connect( a, SIGNAL( activated() ), this, SLOT( save() ) );
    file->insertSeparator();
    a->addTo( bar );
    a->addTo( file );

    a = new QAction( tr( "Save As" ),  Opie::Core::OResource::loadPixmap( "save", Opie::Core::OResource::SmallIcon ),
                     QString::null, 0, this, 0 );
    connect( a, SIGNAL( activated() ), this, SLOT( saveAs() ) );
    a->addTo( file );

    file->insertSeparator();
    deleteAction = new QAction( tr( "Delete" ), Opie::Core::OResource::loadPixmap( "close", Opie::Core::OResource::SmallIcon ),
                     QString::null, 0, this, 0 );
    connect( deleteAction, SIGNAL( activated() ), this, SLOT( fileDelete() ) );
    deleteAction->addTo( file );

    undoAction = new QAction( tr( "Undo" ), Opie::Core::OResource::loadPixmap( "undo", Opie::Core::OResource::SmallIcon ),
                     QString::null, 0, this, 0 );
    undoAction->addTo( edit );
    undoAction->setEnabled( false );

    redoAction = new QAction( tr( "Redo" ), Opie::Core::OResource::loadPixmap( "redo", Opie::Core::OResource::SmallIcon ),
                     QString::null, 0, this, 0 );
    redoAction->addTo( edit );
    redoAction->setEnabled( false );

    edit->insertSeparator();

    a = new QAction( tr( "Cut" ), Opie::Core::OResource::loadPixmap( "cut", Opie::Core::OResource::SmallIcon ),
                     QString::null, 0, this, 0 );
    connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) );
    a->addTo( editBar );
    a->addTo( edit );

    a = new QAction( tr( "Copy" ), Opie::Core::OResource::loadPixmap( "copy", Opie::Core::OResource::SmallIcon ),
                     QString::null, 0, this, 0 );
    connect( a, SIGNAL( activated() ), this, SLOT( editCopy() ) );
    a->addTo( editBar );
    a->addTo( edit );

    a = new QAction( tr( "Paste" ), Opie::Core::OResource::loadPixmap( "paste", Opie::Core::OResource::SmallIcon ),
                     QString::null, 0, this, 0 );
    connect( a, SIGNAL( activated() ), this, SLOT( editPaste() ) );
    a->addTo( editBar );
    a->addTo( edit );


#ifndef QT_NO_CLIPBOARD
    a = new QAction( tr( "Insert Time and Date" ), Opie::Core::OResource::loadPixmap( "paste", Opie::Core::OResource::SmallIcon ),
                     QString::null, 0, this, 0 );
    connect( a, SIGNAL( activated() ), this, SLOT( editPasteTimeDate() ) );
    a->addTo( edit );
#endif

    a = new QAction( tr( "Goto Line..." ), Opie::Core::OResource::loadPixmap( "find", Opie::Core::OResource::SmallIcon ),
                    QString::null, 0, this, 0 );
    connect( a, SIGNAL( activated() ), this, SLOT( gotoLine() ) );
    edit->insertSeparator();
    a->addTo( edit );

    a = new QAction( tr( "Find..." ), Opie::Core::OResource::loadPixmap( "find", Opie::Core::OResource::SmallIcon ),
                     QString::null, 0, this, 0 );
    connect( a, SIGNAL( activated() ), this, SLOT( editFind() ) );
    a->addTo( bar );
    a->addTo( edit );

    zin = new QAction( tr("Zoom in"), QString::null, 0, this, 0 );
    connect( zin, SIGNAL( activated() ), this, SLOT( zoomIn() ) );
    zin->addTo( font );

    zout = new QAction( tr("Zoom out"), QString::null, 0, this, 0 );
    connect( zout, SIGNAL( activated() ), this, SLOT( zoomOut() ) );
    zout->addTo( font );

    font->insertSeparator();

    font->insertItem(tr("Font"), this, SLOT(changeFont()) );

    font->insertSeparator();
    font->insertItem(tr("Advanced Features"), advancedMenu);

    QAction *wa = new QAction( tr("Wrap lines"),
                               QString::null, 0, this, 0 );
    connect( wa, SIGNAL( toggled(bool) ),
             this, SLOT( setWordWrap(bool) ) );
    wa->setToggleAction(true);
    wa->addTo( advancedMenu);

    desktopAction = new QAction( tr("Always open linked file"),
                                 QString::null, 0, this, 0 );
    connect( desktopAction, SIGNAL( toggled(bool) ),
             this, SLOT( doDesktop(bool) ) );
    desktopAction->setToggleAction(true);
    desktopAction->addTo( advancedMenu);

    filePermAction = new QAction( tr("File Permissions"),
                                  QString::null, 0, this, 0 );
    connect( filePermAction, SIGNAL( toggled(bool) ),
             this, SLOT( doFilePerms(bool) ) );
    filePermAction->setToggleAction(true);
    filePermAction->addTo( advancedMenu);

    nAutoSave = new QAction( tr("Auto Save 5 min."),
                                   QString::null, 0, this, 0 );
    connect( nAutoSave, SIGNAL( toggled(bool) ),
             this, SLOT( doTimer(bool) ) );
    nAutoSave->setToggleAction(true);
    nAutoSave->addTo( advancedMenu);

    mb->insertItem( tr( "File" ), file );
    mb->insertItem( tr( "Edit" ), edit );
    mb->insertItem( tr( "View" ), font );

    searchBar = new QToolBar(this);
    addToolBar( searchBar,  "Search", QMainWindow::Top, true );

    searchBar->setHorizontalStretchable( true );

    searchEdit = new QLineEdit( searchBar, "searchEdit" );
    searchBar->setStretchableWidget( searchEdit );
    connect( searchEdit, SIGNAL( textChanged(const QString&) ),
       this, SLOT( search() ) );

    a = new QAction( tr( "Find Next" ), Opie::Core::OResource::loadPixmap( "next", Opie::Core::OResource::SmallIcon ),
                     QString::null, 0, this, 0 );
    connect( a, SIGNAL( activated() ), this, SLOT( findNext() ) );
    a->addTo( searchBar );
    a->addTo( edit );

    a = new QAction( tr( "Close Find" ), Opie::Core::OResource::loadPixmap( "close", Opie::Core::OResource::SmallIcon ),
                     QString::null, 0, this, 0 );
    connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) );
    a->addTo( searchBar );

    searchBar->hide();

    editor = new QpeEditor( this );
    setCentralWidget( editor );
    editor->setFrameStyle( QFrame::Panel | QFrame::Sunken );
    connect( editor, SIGNAL( textChanged() ),
             this, SLOT( editorChanged() ) );
    connect( editor, SIGNAL( undoAvailable(bool) ),
             undoAction, SLOT( setEnabled(bool) ) );
    connect( editor, SIGNAL( redoAvailable(bool) ),
             redoAction, SLOT( setEnabled(bool) ) );
    connect( undoAction, SIGNAL( activated() ), editor, SLOT( undo() ) );
    connect( redoAction, SIGNAL( activated() ), editor, SLOT( redo() ) );

    QPEApplication::setStylusOperation( editor, QPEApplication::RightOnHold);

    Config cfg("TextEdit");
    cfg. setGroup ( "Font" );

    QFont defaultFont = editor-> font ( );

    QString family = cfg. readEntry     ( "Family", defaultFont. family ( ));
    int size       = cfg. readNumEntry  ( "Size",   defaultFont. pointSize ( ));
    int weight     = cfg. readNumEntry  ( "Weight", defaultFont. weight ( ));
    bool italic    = cfg. readBoolEntry ( "Italic", defaultFont. italic ( ));

    defaultFont = QFont ( family, size, weight, italic );
    editor-> setFont ( defaultFont );

    cfg.setGroup ( "View" );

    openDesktop = cfg.readBoolEntry ( "OpenDesktop", true );
    filePerms = cfg.readBoolEntry ( "FilePermissions", false );
    featureAutoSave = cfg.readBoolEntry( "autosave", false);

    if(openDesktop) desktopAction->setOn( true );
    if(filePerms) filePermAction->setOn( true );
    if(featureAutoSave) nAutoSave->setOn(true);

//       {
//           doTimer(true);
//       }

    bool wrap = cfg. readBoolEntry ( "Wrap", true );
    wa-> setOn ( wrap );
    setWordWrap ( wrap );

/////////////////
    if( qApp->argc() > 1) {
        currentFileName=qApp->argv()[1];

        QFileInfo fi(currentFileName);

        if(fi.baseName().left(1) == "") {
            openDotFile(currentFileName);
        }
        else {
            openFile(currentFileName);
        }
    }
    else {
        newFile();
    }
}
Example #30
0
void AdvancedFm::init() {
    b = false;
    setCaption( tr( "AdvancedFm" ) );

//    QFrame* frame = new QFrame(this);
//    setCentralWidget(frame);
//    QVBoxLayout *layout = new QVBoxLayout( frame );

    QVBoxLayout *layout = new QVBoxLayout( this);
    layout->setSpacing( 2);
    layout->setMargin( 0); // squeeze

    QMenuBar *menuBar = new QMenuBar(this);
    menuBar->setMargin( 0 ); // squeeze
    fileMenu = new QPopupMenu( this );
    viewMenu  = new QPopupMenu( this );
//    customDirMenu  = new QPopupMenu( this );

    layout->addWidget( menuBar );

    menuBar->insertItem( tr( "File" ), fileMenu);
    menuBar->insertItem( tr( "View" ), viewMenu);
    connect(fileMenu,SIGNAL(aboutToShow()),this,SLOT(enableDisableMenu()));

    bool useBigIcon = qApp->desktop()->size().width() > 330;

    cdUpButton = new QToolButton( 0,"cdUpButton");
    cdUpButton->setUsesBigPixmap( useBigIcon );
    cdUpButton->setPixmap( Opie::Core::OResource::loadPixmap( "up", Opie::Core::OResource::SmallIcon ) );
    cdUpButton->setAutoRaise( true );
    menuBar->insertItem( cdUpButton );

    qpeDirButton= new QToolButton( 0,"QPEButton");
    qpeDirButton->setUsesBigPixmap( useBigIcon );
    qpeDirButton->setPixmap( Opie::Core::OResource::loadPixmap( "logo/opielogo", Opie::Core::OResource::SmallIcon ) );
    qpeDirButton->setAutoRaise( true );
    menuBar->insertItem( qpeDirButton );

    fsButton = new OFileSystemButton( 0 );
    fsButton->setUsesBigPixmap( useBigIcon );
    fsButton->setAutoRaise( true );
    menuBar->insertItem( fsButton );

    docButton = new QToolButton( 0,"docsButton");
    docButton->setUsesBigPixmap( useBigIcon );
    docButton->setPixmap( Opie::Core::OResource::loadPixmap( "DocsIcon", Opie::Core::OResource::SmallIcon ) );
    docButton->setAutoRaise( true );
    menuBar->insertItem( docButton );

    homeButton = new QToolButton( 0, "homeButton");
    homeButton->setUsesBigPixmap( useBigIcon );
    homeButton->setPixmap( Opie::Core::OResource::loadPixmap( "home", Opie::Core::OResource::SmallIcon ) );
    homeButton->setAutoRaise( true );
    menuBar->insertItem( homeButton );

//    fileMenu->insertItem( tr( "File Search" ), this, SLOT( openSearch() ));
//    fileMenu->insertSeparator();
    fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() ), 0, 101);
    fileMenu->insertItem( tr( "Select All" ), this, SLOT( selectAll() ), 0, 102);
    fileMenu->insertSeparator();
    fileMenu->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() ), 0, 103);
    fileMenu->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() ), 0, 104);
    fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() ), 0, 105);
    fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() ), 0, 106);
    fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() ), 0, 107);
    fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() ), 0, 108);

    viewMenu->insertItem( tr( "Switch to View 1" ), this, SLOT( switchToLocalTab()));
    viewMenu->insertItem( tr( "Switch to View 2" ), this, SLOT( switchToRemoteTab()));
    viewMenu->insertSeparator();
    viewMenu->insertItem( tr( "Refresh" ), this, SLOT( refreshCurrentTab()));
    viewMenu->insertSeparator();
    viewMenu->insertItem( tr( "Show Hidden Files" ), this,  SLOT( showMenuHidden() ));
//    viewMenu->insertSeparator();
//    viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() ));
    viewMenu->setCheckable(true);
    viewMenu->setItemChecked( viewMenu->idAt(0), true);
    viewMenu->setItemChecked( viewMenu->idAt(1), false);
    viewMenu->setItemChecked( viewMenu->idAt(5), false);

    s_addBookmark = tr("Bookmark Directory");
    s_removeBookmark = tr("Remove Current Directory from Bookmarks");

//    menuButton->insertItem("");

//    customDirMenu->insertItem(tr("Add This Directory"));
//    customDirMenu->insertItem(tr("Remove This Directory"));
//    customDirMenu->insertSeparator();

    QHBoxLayout *CBHB = new QHBoxLayout(); // parent layout will be set later
    CBHB->setMargin( 0 );
    CBHB->setSpacing( 1 );

    menuButton = new MenuButton( this );

    menuButton->setUseLabel(false);
    menuButton->setMaximumWidth( 20 );
    menuButton->insertItem( s_addBookmark);
    menuButton->insertItem( s_removeBookmark);
    menuButton->insertSeparator();
//    menuButton->setFocusPolicy(NoFocus);
    CBHB->addWidget( menuButton );

    customDirsToMenu();

    currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" );
    currentPathCombo->setEditable(TRUE);
    currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
//    currentPathCombo->setFocusPolicy(NoFocus);
    CBHB->addWidget( currentPathCombo );

    layout->addLayout( CBHB );

    TabWidget = new OSplitter( Horizontal, this, "TabWidget" );
//    TabWidget = new QTabWidget( this, "TabWidget" );
    layout->addWidget( TabWidget, 4 );

    tab = new QWidget( TabWidget, "tab" );
    tabLayout = new QGridLayout( tab );
    tabLayout->setSpacing( 2);
    tabLayout->setMargin( 2);

    Local_View = new QListView( tab, "Local_View" );
    Local_View->addColumn( tr("File"),130);
    Local_View->addColumn( tr("Size"),-1);
    Local_View->setColumnAlignment(1,QListView::AlignRight);
    Local_View->addColumn( tr("Date"),-1);
    Local_View->setColumnAlignment(2,QListView::AlignRight);
    Local_View->setAllColumnsShowFocus(TRUE);
    Local_View->setMultiSelection( TRUE );
    Local_View->setSelectionMode(QListView::Extended);
    Local_View->setFocusPolicy(StrongFocus);
    Local_View->installEventFilter( this );

    QPEApplication::setStylusOperation( Local_View->viewport() , QPEApplication::RightOnHold);

    tabLayout->addWidget( Local_View, 0, 0 );

    TabWidget->addWidget( tab,"advancedfm/smFileBrowser.png", tr("1"));
//    TabWidget->insertTab( tab, tr("1"));

    tab_2 = new QWidget( TabWidget, "tab_2" );
    tabLayout_2 = new QGridLayout( tab_2 );
    tabLayout_2->setSpacing( 2);
    tabLayout_2->setMargin( 2);

    Remote_View = new QListView( tab_2, "Remote_View" );
    Remote_View->addColumn( tr("File"),130);
    Remote_View->addColumn( tr("Size"),-1);
    Remote_View->setColumnAlignment(1,QListView::AlignRight);
    Remote_View->addColumn( tr("Date"),-1);
    Remote_View->setColumnAlignment(2,QListView::AlignRight);
    Remote_View->setAllColumnsShowFocus(TRUE);
    Remote_View->setMultiSelection( TRUE );
    Remote_View->setSelectionMode(QListView::Extended);
    Remote_View->setFocusPolicy(StrongFocus);
    Remote_View->installEventFilter( this );

    QPEApplication::setStylusOperation( Remote_View->viewport(), QPEApplication::RightOnHold);

    tabLayout_2->addWidget( Remote_View, 0, 0 );

    TabWidget->addWidget( tab_2, "advancedfm/smFileBrowser.png",tr( "2"));
    TabWidget->setSizeChange( 370 );
//    TabWidget->insertTab( tab_2, tr( "2"));

    /*     tab_3 = new QWidget( TabWidget, "tab_3" );
                    tabLayout_3 = new QGridLayout( tab_3 );
                    tabLayout_3->setSpacing( 2);
                    tabLayout_3->setMargin( 2);


                    //     OFileDialog fileDialog;
                    // fileDialog;
                    //    fileSelector = new FileSelector( "*",tab_3, "fileselector" , FALSE, FALSE); //buggy
                    //     fileDialog = new OFileDialog("bangalow", tab_3, 4, 2, "Bungalow");
                    //      OFileSelector fileDialog = new OFileSelector( tab_3, 4, 2,"/");

                    QListView *fileTree;
                    fileTree = new QListView( tab_3, "tree" );


                    tabLayout_3->addMultiCellWidget( fileTree, 0, 0, 0, 3 );

                    TabWidget->insertTab( tab_3, tr( "Remote" ) );
    */

    ///////////////

    currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
    currentDir.setPath( QDir::currentDirPath());

    currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
    currentRemoteDir.setPath( QDir::currentDirPath());

    filterStr="*";
    showHidden();
    TabWidget->setCurrentWidget(0);
}