void TextEdit::setupEditActions()
{
    QToolBar *tb = new QToolBar( this );
    QPopupMenu *menu = new QPopupMenu( this );
    menuBar()->insertItem( tr( "&Edit" ), menu );

    QAction *a;
    a = new QAction( tr( "Undo" ), QPixmap( "textdrawing/undo.png" ), tr( "&Undo" ), CTRL + Key_Z, this, "editUndo" );
    connect( a, SIGNAL( activated() ), this, SLOT( editUndo() ) );
    a->addTo( tb );
    a->addTo( menu );
    a = new QAction( tr( "Redo" ), QPixmap( "textdrawing/redo.png" ), tr( "&Redo" ), CTRL + Key_Y, this, "editRedo" );
    connect( a, SIGNAL( activated() ), this, SLOT( editRedo() ) );
    a->addTo( tb );
    a->addTo( menu );
    menu->insertSeparator();
    a = new QAction( tr( "Cut" ), QPixmap( "textdrawing/editcut.png" ), tr( "&Cut" ), CTRL + Key_X, this, "editCut" );
    connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) );
    a->addTo( tb );
    a->addTo( menu );
    a = new QAction( tr( "Copy" ), QPixmap( "textdrawing/editcopy.png" ), tr( "C&opy" ), CTRL + Key_C, this, "editCopy" );
    connect( a, SIGNAL( activated() ), this, SLOT( editCopy() ) );
    a->addTo( tb );
    a->addTo( menu );
    a = new QAction( tr( "Paste" ), QPixmap( "textdrawing/editpaste.png" ), tr( "&Paste" ), CTRL + Key_V, this, "editPaste" );
    connect( a, SIGNAL( activated() ), this, SLOT( editPaste() ) );
    a->addTo( tb );
    a->addTo( menu );
}
示例#2
0
AS_NAMESPACE_START

EditorTabs::EditorTabs(QWidget *parent)
    : QTabWidget(parent), _finder(nullptr)
{
    _connections << connect(parent, SIGNAL(editCopy()), this, SLOT(onEditCopy()));
    _connections << connect(parent, SIGNAL(editCut()), this, SLOT(onEditCut()));
    _connections << connect(parent, SIGNAL(editFind()), this, SLOT(onEditFind()));
    _connections << connect(parent, SIGNAL(editGoto()), this, SLOT(onEditGoto()));
    _connections << connect(parent, SIGNAL(editPaste()), this, SLOT(onEditPaste()));
    _connections << connect(parent, SIGNAL(editRedo()), this, SLOT(onEditRedo()));
    _connections << connect(parent, SIGNAL(editReplace()), this, SLOT(onEditReplace()));
    _connections << connect(parent, SIGNAL(editUndo()), this, SLOT(onEditUndo()));
    _connections << connect(parent, SIGNAL(fileClose()), this, SLOT(onFileClose()));
    _connections << connect(parent, SIGNAL(fileCloseAll()), this, SLOT(onFileCloseAll()));
    _connections << connect(parent, SIGNAL(fileOpen(QString)), this, SLOT(onFileOpen(QString)));
    _connections << connect(parent, SIGNAL(fileSave()), this, SLOT(onFileSave()));
    _connections << connect(parent, SIGNAL(fileSaveAll()), this, SLOT(onFileSaveAll()));
    _connections << connect(this, &QTabWidget::tabCloseRequested, this, &EditorTabs::onTabCloseRequested);
    _connections << connect(tabBar(), &QTabBar::tabMoved, this, &EditorTabs::onTabMoved);
    _connections << connect(this, &EditorTabs::currentChanged, this, &EditorTabs::onCurrentChanged);
    _connections << connect(this, SIGNAL(fileChanged(QString)), parent, SLOT(onFileChanged(QString)));
    _connections << connect(this, SIGNAL(fileSaved(QString)), parent, SLOT(onFileSaved(QString)));
    setMovable(true);
    setTabsClosable(true);
}
示例#3
0
void TextEdit::setupEditActions()
{
    QToolBar *tb = new QToolBar( this );
    tb->setLabel( "Edit Actions" );
    QPopupMenu *menu = new QPopupMenu( this );
    menuBar()->insertItem( tr( "&Edit" ), menu );

    QAction *a;
    a = new QAction( QPixmap::fromMimeSource( "editundo.xpm" ), tr( "&Undo" ), CTRL + Key_Z, this, "editUndo" );
    connect( a, SIGNAL( activated() ), this, SLOT( editUndo() ) );
    a->addTo( tb );
    a->addTo( menu );
    a = new QAction( QPixmap::fromMimeSource( "editredo.xpm" ), tr( "&Redo" ), CTRL + Key_Y, this, "editRedo" );
    connect( a, SIGNAL( activated() ), this, SLOT( editRedo() ) );
    a->addTo( tb );
    a->addTo( menu );
    menu->insertSeparator();
    a = new QAction( QPixmap::fromMimeSource( "editcopy.xpm" ), tr( "&Copy" ), CTRL + Key_C, this, "editCopy" );
    connect( a, SIGNAL( activated() ), this, SLOT( editCopy() ) );
    a->addTo( tb );
    a->addTo( menu );
    a = new QAction( QPixmap::fromMimeSource( "editcut.xpm" ), tr( "Cu&t" ), CTRL + Key_X, this, "editCut" );
    connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) );
    a->addTo( tb );
    a->addTo( menu );
    a = new QAction( QPixmap::fromMimeSource( "editpaste.xpm" ), tr( "&Paste" ), CTRL + Key_V, this, "editPaste" );
    connect( a, SIGNAL( activated() ), this, SLOT( editPaste() ) );
    a->addTo( tb );
    a->addTo( menu );
}
示例#4
0
bool TextEdit::qt_invoke( int _id, QUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0: fileNew(); break;
    case 1: fileOpen(); break;
    case 2: fileSave(); break;
    case 3: fileSaveAs(); break;
    case 4: filePrint(); break;
    case 5: fileClose(); break;
    case 6: fileExit(); break;
    case 7: editUndo(); break;
    case 8: editRedo(); break;
    case 9: editCut(); break;
    case 10: editCopy(); break;
    case 11: editPaste(); break;
    case 12: textBold(); break;
    case 13: textUnderline(); break;
    case 14: textItalic(); break;
    case 15: textFamily((const QString&)static_QUType_QString.get(_o+1)); break;
    case 16: textSize((const QString&)static_QUType_QString.get(_o+1)); break;
    case 17: textColor(); break;
    case 18: textAlign((QAction*)static_QUType_ptr.get(_o+1)); break;
    case 19: fontChanged((const QFont&)*((const QFont*)static_QUType_ptr.get(_o+1))); break;
    case 20: colorChanged((const QColor&)*((const QColor*)static_QUType_ptr.get(_o+1))); break;
    case 21: alignmentChanged((int)static_QUType_int.get(_o+1)); break;
    case 22: editorChanged((QWidget*)static_QUType_ptr.get(_o+1)); break;
    default:
	return QMainWindow::qt_invoke( _id, _o );
    }
    return TRUE;
}
示例#5
0
GLLUTWidget::GLLUTWidget(LUTChannelMode mode, QWidget *parent) : QGLWidget(parent)
{
  rb=0;
  _lut=0;
  _mode=mode;
  needs_init=false;
  gl_ready=false;
  view_mode=VIEW_SINGLE;
  setFocusPolicy(Qt::StrongFocus);
  cam.reset();
  cam.setPitch( -0.785398163);
  cam.setYaw( -0.785398163);
  cam.setDistance(6.0);


  setMinimumSize(60,40);

  /*QAction * actionSave = new QAction(this);
  actionSave->setObjectName("actionSave");
  actionSave->setIcon(QIcon(":/icons/document-save.png"));
  actionSave->setShortcut(QKeySequence("Ctrl+s"));
  actionSave->setToolTip("Save Image... (Ctrl-s)");
  actionSave->setShortcutContext(Qt::WidgetShortcut);
  addAction(actionSave);*/

  QAction * actionHelp = new QAction(this);
  actionHelp->setObjectName("actionHelp");
  actionHelp->setIcon(QIcon(":/icons/help-contents.png"));
  actionHelp->setShortcut(QKeySequence("Ctrl+h"));
  actionHelp->setToolTip("Show keyboard shortcuts (Ctrl-h)");
  actionHelp->setShortcutContext(Qt::WidgetShortcut);
  addAction(actionHelp);

  /*QAction * actionZoomFit = new QAction(this);
  actionZoomFit->setObjectName("actionZoomFit");
  actionZoomFit->setIcon(QIcon(":/icons/zoom-best-fit.png"));
  actionZoomFit->setShortcut(QKeySequence("Space"));
  actionZoomFit->setToolTip("Zoom to Fit (Space)");
  actionZoomFit->setShortcutContext(Qt::WidgetShortcut);
  addAction(actionZoomFit);*/

  QAction * actionZoomNormal = new QAction(this);
  actionZoomNormal->setObjectName("actionZoomNormal");
  actionZoomNormal->setIcon(QIcon(":/icons/zoom-original.png"));
  actionZoomNormal->setShortcut(QKeySequence("Home"));
  actionZoomNormal->setShortcutContext(Qt::WidgetShortcut);
  actionZoomNormal->setToolTip("Zoom to 100% (Home)");
  addAction(actionZoomNormal);

  QAction * actionSwitchMode = new QAction(this);
  actionSwitchMode->setObjectName("actionSwitchMode");
  actionSwitchMode->setIcon(QIcon(":/icons/3d.png"));
  actionSwitchMode->setShortcut(QKeySequence("Home"));
  actionSwitchMode->setShortcutContext(Qt::WidgetShortcut);
  actionSwitchMode->setToolTip("Switch Mode");
  addAction(actionSwitchMode);

  actionViewToggleBackground = new QAction(this);
  actionViewToggleBackground->setObjectName("actionViewToggleBackground");
  actionViewToggleBackground->setIcon(QIcon(":/icons/background.png"));
  actionViewToggleBackground->setCheckable(true);
  actionViewToggleBackground->setChecked(true);
  actionViewToggleBackground->setShortcut(QKeySequence("b"));
  actionViewToggleBackground->setShortcutContext(Qt::WidgetShortcut);
  actionViewToggleBackground->setToolTip("Display Background");
  addAction(actionViewToggleBackground);

  actionViewToggleOtherChannels = new QAction(this);
  actionViewToggleOtherChannels->setObjectName("actionViewToggleOtherChannels");
  actionViewToggleOtherChannels->setIcon(QIcon(":/icons/colors.png"));
  actionViewToggleOtherChannels->setCheckable(true);
  actionViewToggleOtherChannels->setChecked(true);
  actionViewToggleOtherChannels->setShortcut(QKeySequence("o"));
  actionViewToggleOtherChannels->setShortcutContext(Qt::WidgetShortcut);
  actionViewToggleOtherChannels->setToolTip("Display All Channels");
  if (mode==LUTChannelMode_Bitwise) {
    addAction(actionViewToggleOtherChannels);
  }


  QAction * actionSep = new QAction(this);
  actionSep->setSeparator(true);
  addAction(actionSep);

  actionUndo = new QAction(this);
  actionUndo->setEnabled(false);
  actionUndo->setObjectName("actionUndo");
  actionUndo->setIcon(QIcon(":/icons/undo.png"));
  actionUndo->setShortcut(QKeySequence("Backspace"));
  actionUndo->setShortcutContext(Qt::WidgetShortcut);
  actionUndo->setToolTip("Undo");
  addAction(actionUndo);

  actionRedo = new QAction(this);
  actionUndo->setEnabled(false);
  actionRedo->setObjectName("actionRedo");
  actionRedo->setIcon(QIcon(":/icons/redo.png"));
  actionRedo->setShortcut(QKeySequence("Insert"));
  actionRedo->setShortcutContext(Qt::WidgetShortcut);
  actionRedo->setToolTip("Redo");
  addAction(actionRedo);

  QAction * actionSep2 = new QAction(this);
  actionSep2->setSeparator(true);
  addAction(actionSep2);


  actionExclusiveMode = new QAction(this);
  actionExclusiveMode->setObjectName("actionExclusiveMode");
  actionExclusiveMode->setIcon(QIcon(":/icons/xedit.png"));
  actionExclusiveMode->setCheckable(true);
  actionExclusiveMode->setShortcut(QKeySequence("x"));
  actionExclusiveMode->setShortcutContext(Qt::WidgetShortcut);
  actionExclusiveMode->setToolTip("Exclusive Channel Mode");
  if (mode==LUTChannelMode_Bitwise) {
    addAction(actionExclusiveMode);
  } else {
    actionExclusiveMode->setChecked(true);
  }

  QAction * actionClearSampler = new QAction(this);
  actionClearSampler->setObjectName("actionClearSampler");
  actionClearSampler->setIcon(QIcon(":/icons/xload.png"));
  actionClearSampler->setShortcut(QKeySequence("c"));
  actionClearSampler->setShortcutContext(Qt::WidgetShortcut);
  actionClearSampler->setToolTip("Clear Sampler");
  addAction(actionClearSampler);

  connect(actionViewToggleBackground, SIGNAL(triggered()), this, SLOT(redraw()));
  connect(actionViewToggleOtherChannels, SIGNAL(triggered()), this, SLOT(rebuildAndRedraw()));
  connect(actionSwitchMode, SIGNAL(triggered()), this, SLOT(switchMode()));
  
  connect(actionRedo, SIGNAL(triggered()), this, SLOT(editRedo()));
  connect(actionUndo, SIGNAL(triggered()), this, SLOT(editUndo()));
  connect(actionClearSampler, SIGNAL(triggered()), this, SLOT(clearSampler()));
  //connect(actionSave, SIGNAL(triggered()), this, SLOT(saveImage()));
  connect(actionHelp, SIGNAL(triggered()), this, SLOT(callHelp()));
  
  connect(actionZoomNormal, SIGNAL(triggered()), this, SLOT(callZoomNormal()));

  editClearAll();
}
bool MainWindow::qt_invoke( int _id, QUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0:
        showProperties((QObject*)static_QUType_ptr.get(_o+1));
        break;
    case 1:
        updateProperties((QObject*)static_QUType_ptr.get(_o+1));
        break;
    case 2:
        showDialogHelp();
        break;
    case 3:
        showDebugStep((QObject*)static_QUType_ptr.get(_o+1),(int)static_QUType_int.get(_o+2));
        break;
    case 4:
        showStackFrame((QObject*)static_QUType_ptr.get(_o+1),(int)static_QUType_int.get(_o+2));
        break;
    case 5:
        showErrorMessage((QObject*)static_QUType_ptr.get(_o+1),(int)static_QUType_int.get(_o+2),(const QString&)static_QUType_QString.get(_o+3));
        break;
    case 6:
        finishedRun();
        break;
    case 7:
        breakPointsChanged();
        break;
    case 8:
        fileNew();
        break;
    case 9:
        fileNewDialog();
        break;
    case 10:
        fileNewFile();
        break;
    case 11:
        fileClose();
        break;
    case 12:
        fileQuit();
        break;
    case 13:
        fileCloseProject();
        break;
    case 14:
        fileOpen();
        break;
    case 15:
        fileOpen((const QString&)static_QUType_QString.get(_o+1),(const QString&)static_QUType_QString.get(_o+2));
        break;
    case 16:
        fileOpen((const QString&)static_QUType_QString.get(_o+1),(const QString&)static_QUType_QString.get(_o+2),(const QString&)static_QUType_QString.get(_o+3));
        break;
    case 17:
        fileOpen((const QString&)static_QUType_QString.get(_o+1),(const QString&)static_QUType_QString.get(_o+2),(const QString&)static_QUType_QString.get(_o+3),(bool)static_QUType_bool.get(_o+4));
        break;
    case 18:
        static_QUType_bool.set(_o,fileSave());
        break;
    case 19:
        static_QUType_bool.set(_o,fileSaveForm());
        break;
    case 20:
        static_QUType_bool.set(_o,fileSaveProject());
        break;
    case 21:
        static_QUType_bool.set(_o,fileSaveAs());
        break;
    case 22:
        fileSaveAll();
        break;
    case 23:
        fileCreateTemplate();
        break;
    case 24:
        editUndo();
        break;
    case 25:
        editRedo();
        break;
    case 26:
        editCut();
        break;
    case 27:
        editCopy();
        break;
    case 28:
        editPaste();
        break;
    case 29:
        editDelete();
        break;
    case 30:
        editSelectAll();
        break;
    case 31:
        editLower();
        break;
    case 32:
        editRaise();
        break;
    case 33:
        editAdjustSize();
        break;
    case 34:
        editLayoutHorizontal();
        break;
    case 35:
        editLayoutVertical();
        break;
    case 36:
        editLayoutHorizontalSplit();
        break;
    case 37:
        editLayoutVerticalSplit();
        break;
    case 38:
        editLayoutGrid();
        break;
    case 39:
        editLayoutContainerHorizontal();
        break;
    case 40:
        editLayoutContainerVertical();
        break;
    case 41:
        editLayoutContainerGrid();
        break;
    case 42:
        editBreakLayout();
        break;
    case 43:
        editAccels();
        break;
    case 44:
        editFunctions();
        break;
    case 45:
        editConnections();
        break;
    case 46:
        static_QUType_ptr.set(_o,editSource());
        break;
    case 47:
        static_QUType_ptr.set(_o,editSource((SourceFile*)static_QUType_ptr.get(_o+1)));
        break;
    case 48:
        static_QUType_ptr.set(_o,openSourceEditor());
        break;
    case 49:
        static_QUType_ptr.set(_o,createSourceEditor((QObject*)static_QUType_ptr.get(_o+1),(Project*)static_QUType_ptr.get(_o+2)));
        break;
    case 50:
        static_QUType_ptr.set(_o,createSourceEditor((QObject*)static_QUType_ptr.get(_o+1),(Project*)static_QUType_ptr.get(_o+2),(const QString&)static_QUType_QString.get(_o+3)));
        break;
    case 51:
        static_QUType_ptr.set(_o,createSourceEditor((QObject*)static_QUType_ptr.get(_o+1),(Project*)static_QUType_ptr.get(_o+2),(const QString&)static_QUType_QString.get(_o+3),(const QString&)static_QUType_QString.get(_o+4)));
        break;
    case 52:
        static_QUType_ptr.set(_o,createSourceEditor((QObject*)static_QUType_ptr.get(_o+1),(Project*)static_QUType_ptr.get(_o+2),(const QString&)static_QUType_QString.get(_o+3),(const QString&)static_QUType_QString.get(_o+4),(bool)static_QUType_bool.get(_o+5)));
        break;
    case 53:
        editFormSettings();
        break;
    case 54:
        editProjectSettings();
        break;
    case 55:
        editPixmapCollection();
        break;
    case 56:
        editDatabaseConnections();
        break;
    case 57:
        editPreferences();
        break;
    case 58:
        projectInsertFile();
        break;
    case 59:
        searchFind();
        break;
    case 60:
        searchIncremetalFindMenu();
        break;
    case 61:
        searchIncremetalFind();
        break;
    case 62:
        searchIncremetalFindNext();
        break;
    case 63:
        searchReplace();
        break;
    case 64:
        searchGotoLine();
        break;
    case 65:
        previewForm();
        break;
    case 66:
        previewForm((const QString&)static_QUType_QString.get(_o+1));
        break;
    case 67:
        toolsCustomWidget();
        break;
    case 68:
        toolsConfigure();
        break;
    case 69:
        helpContents();
        break;
    case 70:
        helpManual();
        break;
    case 71:
        helpAbout();
        break;
    case 72:
        helpAboutQt();
        break;
    case 73:
        helpRegister();
        break;
    case 74:
        activeWindowChanged((QWidget*)static_QUType_ptr.get(_o+1));
        break;
    case 75:
        updateUndoRedo((bool)static_QUType_bool.get(_o+1),(bool)static_QUType_bool.get(_o+2),(const QString&)static_QUType_QString.get(_o+3),(const QString&)static_QUType_QString.get(_o+4));
        break;
    case 76:
        updateEditorUndoRedo();
        break;
    case 77:
        toolSelected((QAction*)static_QUType_ptr.get(_o+1));
        break;
    case 78:
        clipboardChanged();
        break;
    case 79:
        selectionChanged();
        break;
    case 80:
        windowsMenuActivated((int)static_QUType_int.get(_o+1));
        break;
    case 81:
        setupWindowActions();
        break;
    case 82:
        createNewTemplate();
        break;
    case 83:
        projectSelected((QAction*)static_QUType_ptr.get(_o+1));
        break;
    case 84:
        setupRecentlyFilesMenu();
        break;
    case 85:
        setupRecentlyProjectsMenu();
        break;
    case 86:
        recentlyFilesMenuActivated((int)static_QUType_int.get(_o+1));
        break;
    case 87:
        recentlyProjectsMenuActivated((int)static_QUType_int.get(_o+1));
        break;
    case 88:
        emitProjectSignals();
        break;
    case 89:
        showStartDialog();
        break;
    case 90:
        doFunctionsChanged();
        break;
    case 91:
        static_QUType_bool.set(_o,openProjectSettings((Project*)static_QUType_ptr.get(_o+1)));
        break;
    default:
        return QMainWindow::qt_invoke( _id, _o );
    }
    return TRUE;
}
/*
 *  Constructs a TestWindow as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 *
 */
TestWindow::TestWindow( QWidget* parent, const char* name, WFlags fl )
    : QMainWindow( parent, name, fl )
{
    (void)statusBar();
    QImage img;
    img.loadFromData( image0_data, sizeof( image0_data ), "PNG" );
    image0 = img;
    img.loadFromData( image1_data, sizeof( image1_data ), "PNG" );
    image1 = img;
    img.loadFromData( image2_data, sizeof( image2_data ), "PNG" );
    image2 = img;
    img.loadFromData( image3_data, sizeof( image3_data ), "PNG" );
    image3 = img;
    img.loadFromData( image4_data, sizeof( image4_data ), "PNG" );
    image4 = img;
    img.loadFromData( image5_data, sizeof( image5_data ), "PNG" );
    image5 = img;
    img.loadFromData( image6_data, sizeof( image6_data ), "PNG" );
    image6 = img;
    img.loadFromData( image7_data, sizeof( image7_data ), "PNG" );
    image7 = img;
    img.loadFromData( image8_data, sizeof( image8_data ), "PNG" );
    image8 = img;
    img.loadFromData( image9_data, sizeof( image9_data ), "PNG" );
    image9 = img;
    if ( !name )
	setName( "TestWindow" );
    setCentralWidget( new QWidget( this, "qt_central_widget" ) );
    TestWindowLayout = new QVBoxLayout( centralWidget(), 11, 6, "TestWindowLayout"); 

    mainPanel = new QGroupBox( centralWidget(), "mainPanel" );
    mainPanel->setPaletteForegroundColor( QColor( 255, 255, 255 ) );
    mainPanel->setPaletteBackgroundColor( QColor( 0, 0, 0 ) );
    mainPanel->setFrameShadow( QGroupBox::Sunken );
    mainPanel->setFlat( FALSE );

    grpbuffer = new QGroupBox( mainPanel, "grpbuffer" );
    grpbuffer->setGeometry( QRect( 10, 20, 320, 60 ) );
    grpbuffer->setPaletteForegroundColor( QColor( 255, 255, 255 ) );
    grpbuffer->setFlat( FALSE );
    TestWindowLayout->addWidget( mainPanel );

    layout1 = new QHBoxLayout( 0, 0, 6, "layout1"); 

    btnStart = new QPushButton( centralWidget(), "btnStart" );
    layout1->addWidget( btnStart );

    btnStop = new QPushButton( centralWidget(), "btnStop" );
    layout1->addWidget( btnStop );
    TestWindowLayout->addLayout( layout1 );

    // actions
    fileNewAction = new QAction( this, "fileNewAction" );
    fileNewAction->setIconSet( QIconSet( image0 ) );
    fileOpenAction = new QAction( this, "fileOpenAction" );
    fileOpenAction->setIconSet( QIconSet( image1 ) );
    fileSaveAction = new QAction( this, "fileSaveAction" );
    fileSaveAction->setIconSet( QIconSet( image2 ) );
    fileSaveAsAction = new QAction( this, "fileSaveAsAction" );
    filePrintAction = new QAction( this, "filePrintAction" );
    filePrintAction->setIconSet( QIconSet( image3 ) );
    fileExitAction = new QAction( this, "fileExitAction" );
    editUndoAction = new QAction( this, "editUndoAction" );
    editUndoAction->setIconSet( QIconSet( image4 ) );
    editRedoAction = new QAction( this, "editRedoAction" );
    editRedoAction->setIconSet( QIconSet( image5 ) );
    editCutAction = new QAction( this, "editCutAction" );
    editCutAction->setIconSet( QIconSet( image6 ) );
    editCopyAction = new QAction( this, "editCopyAction" );
    editCopyAction->setIconSet( QIconSet( image7 ) );
    editPasteAction = new QAction( this, "editPasteAction" );
    editPasteAction->setIconSet( QIconSet( image8 ) );
    editFindAction = new QAction( this, "editFindAction" );
    editFindAction->setIconSet( QIconSet( image9 ) );
    helpContentsAction = new QAction( this, "helpContentsAction" );
    helpIndexAction = new QAction( this, "helpIndexAction" );
    helpAboutAction = new QAction( this, "helpAboutAction" );


    // toolbars


    // menubar
    menubar = new QMenuBar( this, "menubar" );

    menubar->setEnabled( FALSE );
    menubar->setPaletteBackgroundColor( QColor( 239, 239, 239 ) );

    fileMenu = new QPopupMenu( this );
    fileNewAction->addTo( fileMenu );
    fileOpenAction->addTo( fileMenu );
    fileSaveAction->addTo( fileMenu );
    fileSaveAsAction->addTo( fileMenu );
    fileMenu->insertSeparator();
    filePrintAction->addTo( fileMenu );
    fileMenu->insertSeparator();
    fileExitAction->addTo( fileMenu );
    menubar->insertItem( QString(""), fileMenu, 3 );

    editMenu = new QPopupMenu( this );
    editUndoAction->addTo( editMenu );
    editRedoAction->addTo( editMenu );
    editMenu->insertSeparator();
    editCutAction->addTo( editMenu );
    editCopyAction->addTo( editMenu );
    editPasteAction->addTo( editMenu );
    editMenu->insertSeparator();
    editFindAction->addTo( editMenu );
    menubar->insertItem( QString(""), editMenu, 4 );

    Help = new QPopupMenu( this );
    helpContentsAction->addTo( Help );
    helpIndexAction->addTo( Help );
    Help->insertSeparator();
    helpAboutAction->addTo( Help );
    menubar->insertItem( QString(""), Help, 5 );

    languageChange();
    resize( QSize(373, 363).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( fileNewAction, SIGNAL( activated() ), this, SLOT( fileNew() ) );
    connect( fileOpenAction, SIGNAL( activated() ), this, SLOT( fileOpen() ) );
    connect( fileSaveAction, SIGNAL( activated() ), this, SLOT( fileSave() ) );
    connect( fileSaveAsAction, SIGNAL( activated() ), this, SLOT( fileSaveAs() ) );
    connect( filePrintAction, SIGNAL( activated() ), this, SLOT( filePrint() ) );
    connect( fileExitAction, SIGNAL( activated() ), this, SLOT( fileExit() ) );
    connect( editUndoAction, SIGNAL( activated() ), this, SLOT( editUndo() ) );
    connect( editRedoAction, SIGNAL( activated() ), this, SLOT( editRedo() ) );
    connect( editCutAction, SIGNAL( activated() ), this, SLOT( editCut() ) );
    connect( editCopyAction, SIGNAL( activated() ), this, SLOT( editFind() ) );
    connect( editPasteAction, SIGNAL( activated() ), this, SLOT( editPaste() ) );
    connect( editFindAction, SIGNAL( activated() ), this, SLOT( editFind() ) );
    connect( helpIndexAction, SIGNAL( activated() ), this, SLOT( helpIndex() ) );
    connect( helpContentsAction, SIGNAL( activated() ), this, SLOT( helpContents() ) );
    connect( helpAboutAction, SIGNAL( activated() ), this, SLOT( helpAbout() ) );
    connect( btnStart, SIGNAL( released() ), this, SLOT( add() ) );
    connect( btnStop, SIGNAL( released() ), this, SLOT( remove() ) );
}
示例#8
0
void MainMenu::init()
{
#define ADD_ACTION(name, menu, icon, trName, slot, shortcut) \
    action = menu->addAction(icon, trName); \
    action->setShortcut(QKeySequence(QSL(shortcut))); \
    connect(action, SIGNAL(triggered()), this, slot); \
    m_actions[QSL(name)] = action

#define ADD_CHECKABLE_ACTION(name, menu, icon, trName, slot, shortcut) \
    action = menu->addAction(icon, trName); \
    action->setShortcut(QKeySequence(QSL(shortcut))); \
    action->setCheckable(true); \
    connect(action, SIGNAL(triggered(bool)), this, slot); \
    m_actions[QSL(name)] = action

    // Standard actions - needed on Mac to be placed correctly in "application" menu
    QAction* action = new QAction(QIcon::fromTheme(QSL("help-about")), tr("&About QupZilla"), this);
    action->setMenuRole(QAction::AboutRole);
    connect(action, SIGNAL(triggered()), this, SLOT(showAboutDialog()));
    m_actions[QSL("Standard/About")] = action;

    action = new QAction(IconProvider::settingsIcon(), tr("Pr&eferences"), this);
    action->setMenuRole(QAction::PreferencesRole);
    action->setShortcut(QKeySequence(QKeySequence::Preferences));
    connect(action, SIGNAL(triggered()), this, SLOT(showPreferences()));
    m_actions[QSL("Standard/Preferences")] = action;

    action = new QAction(QIcon::fromTheme(QSL("application-exit")), tr("Quit"), this);
    action->setMenuRole(QAction::QuitRole);
    // shortcut set from browserwindow
    connect(action, SIGNAL(triggered()), this, SLOT(quitApplication()));
    m_actions[QSL("Standard/Quit")] = action;

    // File menu
    m_menuFile = new QMenu(tr("&File"));
    connect(m_menuFile, SIGNAL(aboutToShow()), this, SLOT(aboutToShowFileMenu()));
    connect(m_menuFile, SIGNAL(aboutToHide()), this, SLOT(aboutToHideFileMenu()));

    ADD_ACTION("File/NewTab", m_menuFile, IconProvider::newTabIcon(), tr("New Tab"), SLOT(newTab()), "Ctrl+T");
    ADD_ACTION("File/NewWindow", m_menuFile, IconProvider::newWindowIcon(), tr("&New Window"), SLOT(newWindow()), "Ctrl+N");
    ADD_ACTION("File/NewPrivateWindow", m_menuFile, IconProvider::privateBrowsingIcon(), tr("New &Private Window"), SLOT(newPrivateWindow()), "Ctrl+Shift+P");
    ADD_ACTION("File/OpenLocation", m_menuFile, QIcon::fromTheme(QSL("document-open-remote")), tr("Open Location"), SLOT(openLocation()), "Ctrl+L");
    ADD_ACTION("File/OpenFile", m_menuFile, QIcon::fromTheme(QSL("document-open")), tr("Open &File..."), SLOT(openFile()), "Ctrl+O");
    ADD_ACTION("File/CloseWindow", m_menuFile, QIcon::fromTheme(QSL("window-close")), tr("Close Window"), SLOT(closeWindow()), "Ctrl+Shift+W");
    m_menuFile->addSeparator();
    ADD_ACTION("File/SavePageAs", m_menuFile, QIcon::fromTheme(QSL("document-save")), tr("&Save Page As..."), SLOT(savePageAs()), "Ctrl+S");
    ADD_ACTION("File/SavePageScreen", m_menuFile, QIcon::fromTheme(QSL("image-loading")), tr("Save Page Screen"), SLOT(savePageScreen()), "Ctrl+Shift+S");
    ADD_ACTION("File/SendLink", m_menuFile, QIcon::fromTheme(QSL("mail-message-new")), tr("Send Link..."), SLOT(sendLink()), "");
    ADD_ACTION("File/Print", m_menuFile, QIcon::fromTheme(QSL("document-print")), tr("&Print..."), SLOT(printPage()), "Ctrl+P");
    m_menuFile->addSeparator();
    ADD_CHECKABLE_ACTION("File/WorkOffline", m_menuFile, QIcon(), tr("Work &Offline"), SLOT(toggleOfflineMode()), "");
    m_menuFile->addSeparator();
    m_menuFile->addAction(m_actions[QSL("Standard/Quit")]);

    // Edit menu
    m_menuEdit = new QMenu(tr("&Edit"));
    connect(m_menuEdit, SIGNAL(aboutToShow()), this, SLOT(aboutToShowEditMenu()));
    connect(m_menuEdit, SIGNAL(aboutToHide()), this, SLOT(aboutToHideEditMenu()));

    ADD_ACTION("Edit/Undo", m_menuEdit, QIcon::fromTheme(QSL("edit-undo")), tr("&Undo"), SLOT(editUndo()), "Ctrl+Z");
    ADD_ACTION("Edit/Redo", m_menuEdit, QIcon::fromTheme(QSL("edit-redo")), tr("&Redo"), SLOT(editRedo()), "Ctrl+Shift+Z");
    m_menuEdit->addSeparator();
    ADD_ACTION("Edit/Cut", m_menuEdit, QIcon::fromTheme(QSL("edit-cut")), tr("&Cut"), SLOT(editCut()), "Ctrl+X");
    ADD_ACTION("Edit/Copy", m_menuEdit, QIcon::fromTheme(QSL("edit-copy")), tr("C&opy"), SLOT(editCopy()), "Ctrl+C");
    ADD_ACTION("Edit/Paste", m_menuEdit, QIcon::fromTheme(QSL("edit-paste")), tr("&Paste"), SLOT(editPaste()), "Ctrl+V");
    m_menuEdit->addSeparator();
    ADD_ACTION("Edit/SelectAll", m_menuEdit, QIcon::fromTheme(QSL("edit-select-all")), tr("Select &All"), SLOT(editSelectAll()), "Ctrl+A");
    ADD_ACTION("Edit/Find", m_menuEdit, QIcon::fromTheme(QSL("edit-find")), tr("&Find"), SLOT(editFind()), "Ctrl+F");
    m_menuEdit->addSeparator();

    // View menu
    m_menuView = new QMenu(tr("&View"));
    connect(m_menuView, SIGNAL(aboutToShow()), this, SLOT(aboutToShowViewMenu()));
    connect(m_menuView, SIGNAL(aboutToHide()), this, SLOT(aboutToHideViewMenu()));

    QMenu* toolbarsMenu = new QMenu(tr("Toolbars"));
    connect(toolbarsMenu, SIGNAL(aboutToShow()), this, SLOT(aboutToShowToolbarsMenu()));
    QMenu* sidebarMenu = new QMenu(tr("Sidebar"));
    connect(sidebarMenu, SIGNAL(aboutToShow()), this, SLOT(aboutToShowSidebarsMenu()));
    QMenu* encodingMenu = new QMenu(tr("Character &Encoding"));
    connect(encodingMenu, SIGNAL(aboutToShow()), this, SLOT(aboutToShowEncodingMenu()));

    // Create menus to make shortcuts available even before first showing the menu
    m_window->createToolbarsMenu(toolbarsMenu);
    m_window->createSidebarsMenu(sidebarMenu);

    m_menuView->addMenu(toolbarsMenu);
    m_menuView->addMenu(sidebarMenu);
    ADD_CHECKABLE_ACTION("View/ShowStatusBar", m_menuView, QIcon(), tr("Sta&tus Bar"), SLOT(showStatusBar()), "");
    m_menuView->addSeparator();
    ADD_ACTION("View/Stop", m_menuView, QIcon::fromTheme(QSL("process-stop")), tr("&Stop"), SLOT(stop()), "Esc");
    ADD_ACTION("View/Reload", m_menuView, QIcon::fromTheme(QSL("view-refresh")), tr("&Reload"), SLOT(reload()), "F5");
    m_menuView->addSeparator();
    ADD_ACTION("View/ZoomIn", m_menuView, QIcon::fromTheme(QSL("zoom-in")), tr("Zoom &In"), SLOT(zoomIn()), "Ctrl++");
    ADD_ACTION("View/ZoomOut", m_menuView, QIcon::fromTheme(QSL("zoom-out")), tr("Zoom &Out"), SLOT(zoomOut()), "Ctrl+-");
    ADD_ACTION("View/ZoomReset", m_menuView, QIcon::fromTheme(QSL("zoom-original")), tr("Reset"), SLOT(zoomReset()), "Ctrl+0");
    m_menuView->addSeparator();
    ADD_CHECKABLE_ACTION("View/CaretBrowsing", m_menuView, QIcon(), tr("&Caret Browsing"), SLOT(toggleCaretBrowsing()), "F7");
    m_menuView->addMenu(encodingMenu);
    m_menuView->addSeparator();
    ADD_ACTION("View/PageSource", m_menuView, QIcon::fromTheme(QSL("text-html")), tr("&Page Source"), SLOT(showPageSource()), "Ctrl+U");
    ADD_CHECKABLE_ACTION("View/FullScreen", m_menuView, QIcon(), tr("&FullScreen"), SLOT(showFullScreen()), "F11");

    // Tools menu
    m_menuTools = new QMenu(tr("&Tools"));
    connect(m_menuTools, SIGNAL(aboutToShow()), this, SLOT(aboutToShowToolsMenu()));
    connect(m_menuTools, SIGNAL(aboutToHide()), this, SLOT(aboutToHideToolsMenu()));

    ADD_ACTION("Tools/WebSearch", m_menuTools, QIcon(), tr("&Web Search"), SLOT(webSearch()), "Ctrl+K");
    ADD_ACTION("Tools/SiteInfo", m_menuTools, QIcon::fromTheme(QSL("dialog-information")), tr("Site &Info"), SLOT(showSiteInfo()), "Ctrl+I");
    m_menuTools->addSeparator();
    ADD_ACTION("Tools/DownloadManager", m_menuTools, QIcon(), tr("&Download Manager"), SLOT(showDownloadManager()), "Ctrl+Y");
    ADD_ACTION("Tools/CookiesManager", m_menuTools, QIcon(), tr("&Cookies Manager"), SLOT(showCookieManager()), "");
    ADD_ACTION("Tools/AdBlock", m_menuTools, QIcon(), tr("&AdBlock"), SLOT(showAdBlockDialog()), "");
    ADD_ACTION("Tools/RssReader", m_menuTools, QIcon(), tr("RSS &Reader"), SLOT(showRssManager()), "");
    ADD_ACTION("Tools/WebInspector", m_menuTools, QIcon(), tr("Web In&spector"), SLOT(showWebInspector()), "Ctrl+Shift+I");
    ADD_ACTION("Tools/ClearRecentHistory", m_menuTools, QIcon::fromTheme(QSL("edit-clear")), tr("Clear Recent &History"), SLOT(showClearRecentHistoryDialog()), "Ctrl+Shift+Del");
    m_menuTools->addSeparator();

    // Help menu
    m_menuHelp = new QMenu(tr("&Help"));

#ifndef Q_OS_MAC
    ADD_ACTION("Help/AboutQt", m_menuHelp, QIcon(QSL(":/icons/menu/qt.png")), tr("About &Qt"), SLOT(aboutQt()), "");
    m_menuHelp->addAction(m_actions[QSL("Standard/About")]);
    m_menuHelp->addSeparator();
#endif

    ADD_ACTION("Help/InfoAboutApp", m_menuHelp, QIcon::fromTheme(QSL("help-contents")), tr("Information about application"), SLOT(showInfoAboutApp()), "");
    ADD_ACTION("Help/ConfigInfo", m_menuHelp, QIcon(), tr("Configuration Information"), SLOT(showConfigInfo()), "");
    ADD_ACTION("Help/ReportIssue", m_menuHelp, QIcon(), tr("Report &Issue"), SLOT(reportIssue()), "");

    m_actions[QSL("Help/InfoAboutApp")]->setShortcut(QKeySequence(QKeySequence::HelpContents));

    // History menu
    m_menuHistory = new HistoryMenu();
    m_menuHistory->setMainWindow(m_window);

    // Bookmarks menu
    m_menuBookmarks = new BookmarksMenu();
    m_menuBookmarks->setMainWindow(m_window);

    // Other actions
    action = new QAction(QIcon::fromTheme(QSL("user-trash")), tr("Restore &Closed Tab"), this);
    action->setShortcut(QKeySequence(QSL("Ctrl+Shift+T")));
    connect(action, SIGNAL(triggered()), this, SLOT(restoreClosedTab()));
    m_actions[QSL("Other/RestoreClosedTab")] = action;

#ifdef Q_OS_MAC
    m_actions[QSL("View/FullScreen")]->setShortcut(QKeySequence(QSL("F11")));

    // Add standard actions to File Menu (as it won't be ever cleared) and Mac menubar should move them to "Application" menu
    m_menuFile->addAction(m_actions[QSL("Standard/About")]);
    m_menuFile->addAction(m_actions[QSL("Standard/Preferences")]);
#endif

#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
    m_menuEdit->addAction(m_actions[QSL("Standard/Preferences")]);
#elif !defined(Q_OS_MAC)
    m_menuTools->addAction(m_actions[QSL("Standard/Preferences")]);
#endif

#ifndef QTWEBKIT_FROM_2_3
    m_actions[QSL("View/CaretBrowsing")]->setVisible(false);
#endif

    // Menus are hidden by default
    aboutToHideFileMenu();
    aboutToHideViewMenu();
    aboutToHideEditMenu();
    aboutToHideToolsMenu();

    addActionsToWindow();
}
void QFormulatorEditWidget::keyPressEvent( QKeyEvent *e )
{
	switch( e->key() )
	{
    case Qt::Key_Up:
		if( e->modifiers() == Qt::NoModifier || e->modifiers() == Qt::KeypadModifier  )
			OnMoveUp();
		else if( (e->modifiers() & Qt::ControlModifier) && (e->modifiers() & Qt::ShiftModifier) )
			OnMoveCtrlShiftUp();
		else if( e->modifiers() & Qt::ShiftModifier )
			OnMoveShiftUp();
		else if( e->modifiers() & Qt::ControlModifier )
			OnMoveCtrlUp();
        return;
    case Qt::Key_Down:
		if( e->modifiers() == Qt::NoModifier || e->modifiers() == Qt::KeypadModifier  )
			OnMoveDown();
		else if( (e->modifiers() & Qt::ControlModifier) && (e->modifiers() & Qt::ShiftModifier) )
			OnMoveCtrlShiftDown();
		else if( e->modifiers() & Qt::ShiftModifier )
			OnMoveShiftDown();
		else if( e->modifiers() & Qt::ControlModifier )
			OnMoveCtrlDown();
        return;
    case Qt::Key_Left:
		if( e->modifiers() == Qt::NoModifier || e->modifiers() == Qt::KeypadModifier  )
			OnMoveLeft();
		else if( (e->modifiers() & Qt::ControlModifier) && (e->modifiers() & Qt::ShiftModifier) )
			OnMoveCtrlShiftLeft();
		else if( e->modifiers() & Qt::ShiftModifier )
			OnMoveShiftLeft();
		else if( e->modifiers() & Qt::ControlModifier )
			OnMoveCtrlLeft();
        return;
    case Qt::Key_Right:
		if( e->modifiers() == Qt::NoModifier || e->modifiers() == Qt::KeypadModifier  )
			OnMoveRight();
		else if( (e->modifiers() & Qt::ControlModifier) && (e->modifiers() & Qt::ShiftModifier) )
			OnMoveCtrlShiftRight();
		else if( e->modifiers() & Qt::ShiftModifier )
			OnMoveShiftRight();
		else if( e->modifiers() & Qt::ControlModifier )
			OnMoveCtrlRight();
        return;
	case Qt::Key_Home:
		if( e->modifiers() == Qt::NoModifier || e->modifiers() == Qt::KeypadModifier  )
			OnMoveHome();
		else if( (e->modifiers() & Qt::ControlModifier) && (e->modifiers() & Qt::ShiftModifier) )
			OnMoveCtrlShiftHome();
		else if( e->modifiers() & Qt::ShiftModifier )
			OnMoveShiftHome();
		else if( e->modifiers() & Qt::ControlModifier )
			OnMoveCtrlHome();
        return;
	case Qt::Key_End:
		if( e->modifiers() == Qt::NoModifier || e->modifiers() == Qt::KeypadModifier  )
			OnMoveEnd();
		else if( (e->modifiers() & Qt::ControlModifier) && (e->modifiers() & Qt::ShiftModifier) )
			OnMoveCtrlShiftEnd();
		else if( e->modifiers() & Qt::ShiftModifier )
			OnMoveShiftEnd();
		else if( e->modifiers() & Qt::ControlModifier )
			OnMoveCtrlEnd();
		break;
	case Qt::Key_PageUp:
		if( e->modifiers() == Qt::NoModifier || e->modifiers() == Qt::KeypadModifier  )
			OnMovePageUp();
		else if( (e->modifiers() & Qt::ControlModifier) && (e->modifiers() & Qt::ShiftModifier) )
			OnMoveCtrlShiftPageUp();
		else if( e->modifiers() & Qt::ShiftModifier )
			OnMoveShiftPageUp();
		else if( e->modifiers() & Qt::ControlModifier )
			OnMoveCtrlPageUp();
        return;
	case Qt::Key_PageDown:
		if( e->modifiers() == Qt::NoModifier || e->modifiers() == Qt::KeypadModifier  )
			OnMovePageDown();
		else if( (e->modifiers() & Qt::ControlModifier) && (e->modifiers() & Qt::ShiftModifier) )
			OnMoveCtrlShiftPageDown();
		else if( e->modifiers() & Qt::ShiftModifier )
			OnMoveShiftPageDown();
		else if( e->modifiers() & Qt::ControlModifier )
			OnMoveCtrlPageDown();
        return;
	case Qt::Key_Backspace:
		if( e->modifiers() == Qt::NoModifier )
			BackSpace();
        return;
	case Qt::Key_Delete:
		if( e->modifiers() == Qt::NoModifier || e->modifiers() == Qt::KeypadModifier )
			Delete();
        return;
    case Qt::Key_Return:
		if( e->modifiers() == Qt::NoModifier || e->modifiers() == Qt::KeypadModifier  )
		{
			rootNode()->MoveReturn();
			updateViewDocument();
			//cbFireEvent( FORMULIB_CALLBACK_ENTER, NULL, NULL );
		}
        return;
    case Qt::Key_Escape:
		if( e->modifiers() == Qt::NoModifier )
		{
			rootNode()->Escape();
			updateFormulatorWidget();
		}
        return;
	default:
		break;
	}

	if( e->matches( QKeySequence::Copy ) )
	{
		editCopy();
		return;
	}
	else if( e->matches( QKeySequence::Cut ) )
	{
		editCut();
		return;
	}
	else if( e->matches( QKeySequence::Paste ) )
	{
		editPaste();
		return;
	}
	if( e->matches( QKeySequence::Delete ) )
	{
		Delete();
		return;
	}
	else if( e->matches( QKeySequence::Undo ) )
	{
		editUndo();
		return;
	}
	else if( e->matches( QKeySequence::Redo ) )
	{
		editRedo();
		return;
	}
	else if( e->matches( QKeySequence::SelectAll ) )
	{
		editSelectAll();
	}
	else if( e->matches( QKeySequence::ZoomIn ) )
	{
		double value = qMin( scale() + DEFAULT_VIEWSCALE_STEP, DEFAULT_VIEWSCALE_MAX );
		setScale( value );
	}
	else if( e->matches( QKeySequence::ZoomOut ) )
	{
		double value = qMax( scale() - DEFAULT_VIEWSCALE_STEP, DEFAULT_VIEWSCALE_MIN );
		setScale( value );
	}
	else if( e->text().length() > 0 )
	{
		for( long i = 0; i < e->text().length(); i++ )
			rootNode()->Char( e->text().at( i ).unicode(), undoRedo() );
		updateViewDocument();
		//cbFireEvent( FORMULIB_CALLBACK_CHAR, nChar, NULL );
	}

	QFormulatorWidget::keyPressEvent( e );
}
/*
 *  Constructs a MainWindow as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 *
 */
MainWindow::MainWindow( QWidget* parent, const char* name, WFlags fl )
    : QMainWindow( parent, name, fl )
{
    (void)statusBar();
    QImage img;
    img.loadFromData( image0_data, sizeof( image0_data ), "PNG" );
    image0 = img;
    img.loadFromData( image1_data, sizeof( image1_data ), "PNG" );
    image1 = img;
    img.loadFromData( image2_data, sizeof( image2_data ), "PNG" );
    image2 = img;
    img.loadFromData( image3_data, sizeof( image3_data ), "PNG" );
    image3 = img;
    img.loadFromData( image4_data, sizeof( image4_data ), "PNG" );
    image4 = img;
    img.loadFromData( image5_data, sizeof( image5_data ), "PNG" );
    image5 = img;
    img.loadFromData( image6_data, sizeof( image6_data ), "PNG" );
    image6 = img;
    img.loadFromData( image7_data, sizeof( image7_data ), "PNG" );
    image7 = img;
    img.loadFromData( image8_data, sizeof( image8_data ), "PNG" );
    image8 = img;
    img.loadFromData( image9_data, sizeof( image9_data ), "PNG" );
    image9 = img;
    if ( !name )
	setName( "MainWindow" );
    setCentralWidget( new QWidget( this, "qt_central_widget" ) );

    QWidget* privateLayoutWidget = new QWidget( centralWidget(), "layout8" );
    privateLayoutWidget->setGeometry( QRect( 1, 11, 340, 300 ) );
    layout8 = new QVBoxLayout( privateLayoutWidget, 11, 6, "layout8"); 

    BotonesLector = new QButtonGroup( privateLayoutWidget, "BotonesLector" );
    BotonesLector->setColumnLayout(0, Qt::Vertical );
    BotonesLector->layout()->setSpacing( 6 );
    BotonesLector->layout()->setMargin( 11 );
    BotonesLectorLayout = new QHBoxLayout( BotonesLector->layout() );
    BotonesLectorLayout->setAlignment( Qt::AlignTop );

    layout9 = new QHBoxLayout( 0, 0, 6, "layout9"); 

    pushButton1 = new QPushButton( BotonesLector, "pushButton1" );
    layout9->addWidget( pushButton1 );

    pushButton2 = new QPushButton( BotonesLector, "pushButton2" );
    layout9->addWidget( pushButton2 );
    BotonesLectorLayout->addLayout( layout9 );
    layout8->addWidget( BotonesLector );

    layout6 = new QHBoxLayout( 0, 0, 6, "layout6"); 

    layout5 = new QVBoxLayout( 0, 0, 6, "layout5"); 

    txtSldrTitleTemp = new QLabel( privateLayoutWidget, "txtSldrTitleTemp" );
    txtSldrTitleTemp->setFrameShape( QLabel::Box );
    txtSldrTitleTemp->setScaledContents( FALSE );
    layout5->addWidget( txtSldrTitleTemp );

    sldrTemp = new QSlider( privateLayoutWidget, "sldrTemp" );
    sldrTemp->setMaxValue( 4 );
    sldrTemp->setOrientation( QSlider::Vertical );
    layout5->addWidget( sldrTemp );

    txtTemp = new QLabel( privateLayoutWidget, "txtTemp" );
    QFont txtTemp_font(  txtTemp->font() );
    txtTemp_font.setPointSize( 8 );
    txtTemp->setFont( txtTemp_font ); 
    layout5->addWidget( txtTemp );
    layout6->addLayout( layout5 );

    Grupo1 = new QGroupBox( privateLayoutWidget, "Grupo1" );
    layout6->addWidget( Grupo1 );

    layout4 = new QVBoxLayout( 0, 0, 6, "layout4"); 

    txtSldrTitleVelocidad = new QLabel( privateLayoutWidget, "txtSldrTitleVelocidad" );
    txtSldrTitleVelocidad->setFrameShape( QLabel::Box );
    txtSldrTitleVelocidad->setScaledContents( FALSE );
    layout4->addWidget( txtSldrTitleVelocidad );

    sldrVelocidad = new QSlider( privateLayoutWidget, "sldrVelocidad" );
    sldrVelocidad->setOrientation( QSlider::Vertical );
    layout4->addWidget( sldrVelocidad );

    txtVelocidad = new QLabel( privateLayoutWidget, "txtVelocidad" );
    QFont txtVelocidad_font(  txtVelocidad->font() );
    txtVelocidad_font.setPointSize( 8 );
    txtVelocidad->setFont( txtVelocidad_font ); 
    layout4->addWidget( txtVelocidad );
    layout6->addLayout( layout4 );
    layout8->addLayout( layout6 );

    BotonActivar = new QButtonGroup( privateLayoutWidget, "BotonActivar" );
    BotonActivar->setColumnLayout(0, Qt::Vertical );
    BotonActivar->layout()->setSpacing( 6 );
    BotonActivar->layout()->setMargin( 11 );
    BotonActivarLayout = new QHBoxLayout( BotonActivar->layout() );
    BotonActivarLayout->setAlignment( Qt::AlignTop );

    btnIniciar = new QPushButton( BotonActivar, "btnIniciar" );
    btnIniciar->setToggleButton( TRUE );
    BotonActivarLayout->addWidget( btnIniciar );
    layout8->addWidget( BotonActivar );

    // actions
    fileNewAction = new QAction( this, "fileNewAction" );
    fileNewAction->setIconSet( QIconSet( image0 ) );
    fileOpenAction = new QAction( this, "fileOpenAction" );
    fileOpenAction->setIconSet( QIconSet( image1 ) );
    fileSaveAction = new QAction( this, "fileSaveAction" );
    fileSaveAction->setIconSet( QIconSet( image2 ) );
    fileSaveAsAction = new QAction( this, "fileSaveAsAction" );
    filePrintAction = new QAction( this, "filePrintAction" );
    filePrintAction->setIconSet( QIconSet( image3 ) );
    fileExitAction = new QAction( this, "fileExitAction" );
    editUndoAction = new QAction( this, "editUndoAction" );
    editUndoAction->setIconSet( QIconSet( image4 ) );
    editRedoAction = new QAction( this, "editRedoAction" );
    editRedoAction->setIconSet( QIconSet( image5 ) );
    editCutAction = new QAction( this, "editCutAction" );
    editCutAction->setIconSet( QIconSet( image6 ) );
    editCopyAction = new QAction( this, "editCopyAction" );
    editCopyAction->setIconSet( QIconSet( image7 ) );
    editPasteAction = new QAction( this, "editPasteAction" );
    editPasteAction->setIconSet( QIconSet( image8 ) );
    editFindAction = new QAction( this, "editFindAction" );
    editFindAction->setIconSet( QIconSet( image9 ) );
    helpContentsAction = new QAction( this, "helpContentsAction" );
    helpIndexAction = new QAction( this, "helpIndexAction" );
    helpAboutAction = new QAction( this, "helpAboutAction" );


    // toolbars


    // menubar
    menubar = new QMenuBar( this, "menubar" );


    fileMenu = new QPopupMenu( this );
    fileOpenAction->addTo( fileMenu );
    fileSaveAction->addTo( fileMenu );
    fileMenu->insertSeparator();
    fileMenu->insertSeparator();
    fileExitAction->addTo( fileMenu );
    menubar->insertItem( QString(""), fileMenu, 1 );

    helpMenu = new QPopupMenu( this );
    helpMenu->insertSeparator();
    helpAboutAction->addTo( helpMenu );
    menubar->insertItem( QString(""), helpMenu, 2 );

    languageChange();
    resize( QSize(351, 352).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( fileNewAction, SIGNAL( activated() ), this, SLOT( fileNew() ) );
    connect( fileOpenAction, SIGNAL( activated() ), this, SLOT( fileOpen() ) );
    connect( fileSaveAction, SIGNAL( activated() ), this, SLOT( fileSave() ) );
    connect( fileSaveAsAction, SIGNAL( activated() ), this, SLOT( fileSaveAs() ) );
    connect( filePrintAction, SIGNAL( activated() ), this, SLOT( filePrint() ) );
    connect( fileExitAction, SIGNAL( activated() ), this, SLOT( fileExit() ) );
    connect( editUndoAction, SIGNAL( activated() ), this, SLOT( editUndo() ) );
    connect( editRedoAction, SIGNAL( activated() ), this, SLOT( editRedo() ) );
    connect( editCutAction, SIGNAL( activated() ), this, SLOT( editCut() ) );
    connect( editCopyAction, SIGNAL( activated() ), this, SLOT( editCopy() ) );
    connect( editPasteAction, SIGNAL( activated() ), this, SLOT( editPaste() ) );
    connect( editFindAction, SIGNAL( activated() ), this, SLOT( editFind() ) );
    connect( helpIndexAction, SIGNAL( activated() ), this, SLOT( helpIndex() ) );
    connect( helpContentsAction, SIGNAL( activated() ), this, SLOT( helpContents() ) );
    connect( helpAboutAction, SIGNAL( activated() ), this, SLOT( helpAbout() ) );
    connect( sldrTemp, SIGNAL( valueChanged(int) ), txtTemp, SLOT( setNum(int) ) );
    connect( sldrVelocidad, SIGNAL( valueChanged(int) ), txtVelocidad, SLOT( setNum(int) ) );
    connect( BotonActivar, SIGNAL( toggled(bool) ), this, SLOT( Activar(bool) ) );
}
bool TestWindow::qt_invoke( int _id, QUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0:
        fileNew();
        break;
    case 1:
        fileOpen();
        break;
    case 2:
        fileSave();
        break;
    case 3:
        fileSaveAs();
        break;
    case 4:
        filePrint();
        break;
    case 5:
        fileExit();
        break;
    case 6:
        editUndo();
        break;
    case 7:
        editRedo();
        break;
    case 8:
        editCut();
        break;
    case 9:
        add();
        break;
    case 10:
        editPaste();
        break;
    case 11:
        editFind();
        break;
    case 12:
        helpIndex();
        break;
    case 13:
        helpContents();
        break;
    case 14:
        helpAbout();
        break;
    case 15:
        static_QUType_ptr.set(_o,remove());
        break;
    case 16:
        begin();
        break;
    case 17:
        end();
        break;
    case 18:
        languageChange();
        break;
    default:
        return QMainWindow::qt_invoke( _id, _o );
    }
    return TRUE;
}
示例#12
0
PopupWindow::PopupWindow(PopupWebView* view)
    : QWidget()
    , m_view(view)
    , m_page(qobject_cast<PopupWebPage*>(view->page()))
    , m_search(0)
{
    m_layout = new QVBoxLayout(this);
    m_layout->setContentsMargins(0, 0, 0, 0);
    m_layout->setSpacing(0);

    m_locationBar = new PopupLocationBar(this);
    m_locationBar->setView(m_view);

    m_statusBar = new QStatusBar(this);
    m_statusBar->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);

    m_progressBar = new ProgressBar(m_statusBar);
    m_statusBar->addPermanentWidget(m_progressBar);
    m_progressBar->hide();

    m_view->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    m_statusBarMessage = new PopupStatusBarMessage(this);

    m_menuBar = new QMenuBar(this);

    QMenu* menuFile = new QMenu(tr("File"));
    menuFile->addAction(QIcon::fromTheme("document-save"), tr("&Save Page As..."), m_view, SLOT(savePageAs()))->setShortcut(QKeySequence("Ctrl+S"));
    menuFile->addAction(tr("Save Page Screen"), this, SLOT(savePageScreen()));
    menuFile->addAction(QIcon::fromTheme("mail-message-new"), tr("Send Link..."), m_view, SLOT(sendPageByMail()));
    menuFile->addAction(QIcon::fromTheme("document-print"), tr("&Print..."), m_view, SLOT(printPage()))->setShortcut(QKeySequence("Ctrl+P"));
    menuFile->addSeparator();
    menuFile->addAction(QIcon::fromTheme("window-close"), tr("Close"), this, SLOT(close()))->setShortcut(QKeySequence("Ctrl+W"));
    m_menuBar->addMenu(menuFile);

    m_menuEdit = new QMenu(tr("Edit"));
    m_menuEdit->addAction(QIcon::fromTheme("edit-undo"), tr("&Undo"), this, SLOT(editUndo()))->setShortcut(QKeySequence("Ctrl+Z"));
    m_menuEdit->addAction(QIcon::fromTheme("edit-redo"), tr("&Redo"), this, SLOT(editRedo()))->setShortcut(QKeySequence("Ctrl+Shift+Z"));
    m_menuEdit->addSeparator();
    m_menuEdit->addAction(QIcon::fromTheme("edit-cut"), tr("&Cut"), this, SLOT(editCut()))->setShortcut(QKeySequence("Ctrl+X"));
    m_menuEdit->addAction(QIcon::fromTheme("edit-copy"), tr("C&opy"), this, SLOT(editCopy()))->setShortcut(QKeySequence("Ctrl+C"));
    m_menuEdit->addAction(QIcon::fromTheme("edit-paste"), tr("&Paste"), this, SLOT(editPaste()))->setShortcut(QKeySequence("Ctrl+V"));
    m_menuEdit->addSeparator();
    m_menuEdit->addAction(QIcon::fromTheme("edit-select-all"), tr("Select All"), m_view, SLOT(selectAll()))->setShortcut(QKeySequence("Ctrl+A"));
    m_menuEdit->addAction(QIcon::fromTheme("edit-find"), tr("Find"), this, SLOT(searchOnPage()))->setShortcut(QKeySequence("Ctrl+F"));
    connect(m_menuEdit, SIGNAL(aboutToShow()), this, SLOT(aboutToShowEditMenu()));
    m_menuBar->addMenu(m_menuEdit);

    m_menuView = new QMenu(tr("View"));
    m_actionStop = m_menuView->addAction(qIconProvider->standardIcon(QStyle::SP_BrowserStop), tr("&Stop"), m_view, SLOT(stop()));
    m_actionStop->setShortcut(QKeySequence("Esc"));
    m_actionReload = m_menuView->addAction(qIconProvider->standardIcon(QStyle::SP_BrowserReload), tr("&Reload"), m_view, SLOT(reload()));
    m_actionReload->setShortcut(QKeySequence("F5"));
    m_menuView->addSeparator();
    m_menuView->addAction(QIcon::fromTheme("zoom-in"), tr("Zoom &In"), m_view, SLOT(zoomIn()))->setShortcut(QKeySequence("Ctrl++"));
    m_menuView->addAction(QIcon::fromTheme("zoom-out"), tr("Zoom &Out"), m_view, SLOT(zoomOut()))->setShortcut(QKeySequence("Ctrl+-"));
    m_menuView->addAction(QIcon::fromTheme("zoom-original"), tr("Reset"), m_view, SLOT(zoomReset()))->setShortcut(QKeySequence("Ctrl+0"));
    m_menuView->addSeparator();
    m_menuView->addAction(QIcon::fromTheme("text-html"), tr("&Page Source"), m_view, SLOT(showSource()))->setShortcut(QKeySequence("Ctrl+U"));
    m_menuBar->addMenu(m_menuView);

    // Make shortcuts available even with hidden menubar
    QList<QAction*> actions = m_menuBar->actions();
    foreach(QAction * action, actions) {
        if (action->menu()) {
            actions += action->menu()->actions();
        }
        addAction(action);
    }

    m_layout->insertWidget(0, m_menuBar);
    m_layout->addWidget(m_locationBar);
    m_layout->addWidget(m_view);
    m_layout->addWidget(m_statusBar);
    setLayout(m_layout);

    connect(m_view, SIGNAL(showNotification(QWidget*)), this, SLOT(showNotification(QWidget*)));
    connect(m_view, SIGNAL(titleChanged(QString)), this, SLOT(titleChanged()));
    connect(m_view, SIGNAL(urlChanged(QUrl)), m_locationBar, SLOT(showUrl(QUrl)));
    connect(m_view, SIGNAL(iconChanged()), m_locationBar, SLOT(showIcon()));
    connect(m_view, SIGNAL(statusBarMessage(QString)), this, SLOT(showStatusBarMessage(QString)));
    connect(m_view, SIGNAL(loadStarted()), this, SLOT(loadStarted()));
    connect(m_view, SIGNAL(loadProgress(int)), this, SLOT(loadProgress(int)));
    connect(m_view, SIGNAL(loadFinished(bool)), this, SLOT(loadFinished()));

    connect(m_page, SIGNAL(linkHovered(QString, QString, QString)), this, SLOT(showStatusBarMessage(QString)));
    connect(m_page, SIGNAL(geometryChangeRequested(QRect)), this, SLOT(setWindowGeometry(QRect)));
    connect(m_page, SIGNAL(statusBarVisibilityChangeRequested(bool)), this, SLOT(setStatusBarVisibility(bool)));
    connect(m_page, SIGNAL(menuBarVisibilityChangeRequested(bool)), this, SLOT(setMenuBarVisibility(bool)));
    connect(m_page, SIGNAL(toolBarVisibilityChangeRequested(bool)), this, SLOT(setToolBarVisibility(bool)));

    m_view->setFocus();
    titleChanged();

    QUrl urlToShow = m_view->url();
    if (urlToShow.isEmpty()) {
        urlToShow = m_view->page()->mainFrame()->requestedUrl();
    }

    m_locationBar->showUrl(urlToShow);

    // Ensuring correct sizes for widgets in layout are calculated even
    // before calling QWidget::show()
    m_layout->invalidate();
    m_layout->activate();
}