Exemplo n.º 1
0
PictureContent::PictureContent(QGraphicsScene * scene, QGraphicsItem * parent)
    : AbstractContent(scene, parent, false)
    , m_photo(0)
    , m_opaquePhoto(false)
    , m_progress(0)
    , m_netWidth(0)
    , m_netHeight(0)
    , m_netReply(0)
{
    // enable frame text
    setFrameTextEnabled(true);
    setFrameText(tr("..."));

    // add flipping buttons
    ButtonItem * bFlipH = new ButtonItem(ButtonItem::FlipH, Qt::blue, QIcon(":/data/action-flip-horizontal.png"), this);
    bFlipH->setToolTip(tr("Flip horizontally"));
    bFlipH->setFlag(QGraphicsItem::ItemIgnoresTransformations, false);
    connect(bFlipH, SIGNAL(clicked()), this, SIGNAL(flipHorizontally()));
    addButtonItem(bFlipH);

    ButtonItem * bFlipV = new ButtonItem(ButtonItem::FlipV, Qt::blue, QIcon(":/data/action-flip-vertical.png"), this);
    bFlipV->setToolTip(tr("Flip vertically"));
    bFlipV->setFlag(QGraphicsItem::ItemIgnoresTransformations, false);
    addButtonItem(bFlipV);
    connect(bFlipV, SIGNAL(clicked()), this, SIGNAL(flipVertically()));

    /*ButtonItem * bCrop = new ButtonItem(ButtonItem::Control, Qt::blue, QIcon(":/data/action-scale.png"), this);
    bCrop->setToolTip(tr(""));
    bCrop->setFlag(QGraphicsItem::ItemIgnoresTransformations, false);
    addButtonItem(bCrop);
    connect(bCrop, SIGNAL(clicked()), this, SIGNAL(toggleCropMode()));*/
}
Exemplo n.º 2
0
CircuitView::CircuitView(CircuitDocument *circuitDocument, ViewContainer *viewContainer, uint viewAreaId, const char *name)
        : ICNView(circuitDocument, viewContainer, viewAreaId, name),
        p_circuitDocument(circuitDocument) {
    KActionCollection *ac = actionCollection();

    new KAction("Dump linear equations", Qt::CTRL | Qt::Key_D, circuitDocument, SLOT(displayEquations()), ac, "dump_les");

    //BEGIN Item Control Actions
    KRadioAction * ra;
    ra = new KRadioAction(i18n("0 Degrees"), "", 0, circuitDocument, SLOT(setOrientation0()), ac, "edit_orientation_0");
    ra->setExclusiveGroup("orientation");
    ra->setChecked(true);
    ra = new KRadioAction(i18n("90 Degrees"), "", 0, circuitDocument, SLOT(setOrientation90()), ac, "edit_orientation_90");
    ra->setExclusiveGroup("orientation");
    ra = new KRadioAction(i18n("180 Degrees"), "", 0, circuitDocument, SLOT(setOrientation180()), ac, "edit_orientation_180");
    ra->setExclusiveGroup("orientation");
    ra = new KRadioAction(i18n("270 Degrees"), "", 0, circuitDocument, SLOT(setOrientation270()), ac, "edit_orientation_270");
    ra->setExclusiveGroup("orientation");

    new KAction(i18n("Create Subcircuit"), "", 0, circuitDocument, SLOT(createSubcircuit()), ac, "circuit_create_subcircuit");
    new KAction(i18n("Rotate Clockwise"), "rotate_cw", "]", circuitDocument, SLOT(rotateClockwise()), ac, "edit_rotate_cw");
    new KAction(i18n("Rotate Counter-Clockwise"), "rotate_ccw", "[", circuitDocument, SLOT(rotateCounterClockwise()), ac, "edit_rotate_ccw");
    new KAction(i18n("Flip Horizontally"), "", 0, circuitDocument, SLOT(flipHorizontally()), ac, "edit_flip_horizontally");
    new KAction(i18n("Flip Vertically"), "", 0, circuitDocument, SLOT(flipVertically()), ac, "edit_flip_vertically");
    //END Item Control Actions

    setXMLFile("ktechlabcircuitui.rc", true);

    QWhatsThis::add(this, i18n(
                        "Construct a circuit by dragging components from the Component selector from the left. Create the connections by dragging a wire from the component connectors.<br><br>"

                        "The simulation is running by default, but can be paused and resumed from the Tools menu.<br><br>"

                        "To delete a wire, select it with a select box, and hit delete.<br><br>"

                        "To edit the attributes of a component, select it (making sure that no components of another type are also selected), and edit in the toolbar. More advanced properties can be edited using the item editor on the right.<br><br>"

                        "Subcircuits can be created by connecting the components with an External Connection, selecting the desired components and clicking on \"Create Subcircuit\" in the right-click menu.")
                   );

    m_pViewIface = new CircuitViewIface(this);

    m_statusBar->insertItem("", ViewStatusBar::SimulationState);
    connect(Simulator::self(), SIGNAL(simulatingStateChanged(bool)), this, SLOT(slotUpdateRunningStatus(bool)));
    slotUpdateRunningStatus(Simulator::self()->isSimulating());
}
Exemplo n.º 3
0
bool Sprite::loading(Resources &resources) {
	if (_fileName.empty())
		return true;

	byte   flippedHorizontally = _flippedHorizontally;
	byte   flippedVertically   = _flippedVertically;
	uint32 scale               = _scale;

	loadFromImage(resources, _fileName);

	if (flippedHorizontally)
		flipHorizontally();
	if (flippedVertically)
		flipVertically();

	setScale(scale);

	return true;
}
Exemplo n.º 4
0
PictureContent::PictureContent(bool spontaneous, QGraphicsScene * scene, QGraphicsItem * parent)
    : AbstractContent(scene, spontaneous, false, parent)
    , m_photo(0)
    , m_opaquePhoto(false)
    , m_progress(0)
    , m_netWidth(0)
    , m_netHeight(0)
    , m_netReply(0)
    , m_watcher(0)
    , m_watcherTimer(0)
{
    // enable frame text
    setFrameTextEnabled(true);
    setFrameText(tr("..."));

    // allow dropping
    setAcceptDrops(true);

    // add flipping buttons
    ButtonItem * bFlipH = new ButtonItem(ButtonItem::FlipH, Qt::blue, QIcon(":/data/action-flip-horizontal.png"), this);
    bFlipH->setToolTip(tr("Flip horizontally"));
    bFlipH->setFlag(QGraphicsItem::ItemIgnoresTransformations, false);
    connect(bFlipH, SIGNAL(clicked()), this, SIGNAL(flipHorizontally()));
    addButtonItem(bFlipH);

    ButtonItem * bFlipV = new ButtonItem(ButtonItem::FlipV, Qt::blue, QIcon(":/data/action-flip-vertical.png"), this);
    bFlipV->setToolTip(tr("Flip vertically"));
    bFlipV->setFlag(QGraphicsItem::ItemIgnoresTransformations, false);
    addButtonItem(bFlipV);
    connect(bFlipV, SIGNAL(clicked()), this, SIGNAL(flipVertically()));

#if 0
    // add cropping button (TODO: enable this?)
    ButtonItem * bCrop = new ButtonItem(ButtonItem::Control, Qt::blue, QIcon(":/data/action-scale.png"), this);
    bCrop->setToolTip(tr(""));
    bCrop->setFlag(QGraphicsItem::ItemIgnoresTransformations, false);
    addButtonItem(bCrop);
    connect(bCrop, SIGNAL(clicked()), this, SIGNAL(requestCrop()));
#endif
}
Exemplo n.º 5
0
void MainWindow::createActions()
{
    openAct = new QAction(tr("&Open"), this);
    openAct->setToolTip(tr("Open an image"));
    actionsManager->addAction(openAct, "_open", this, this, SLOT(open()), QKeySequence::Open);

    saveAct = new QAction(tr("&Save"), this);
    saveAct->setEnabled(false);
    actionsManager->addAction(saveAct, "_save", this, this, SLOT(save()), QKeySequence::Save);

    exitAct = new QAction(tr("&Exit"), this);
    actionsManager->addAction(exitAct, "_exit", this, this, SLOT(close()), QKeySequence::Quit);

    filePropertiesAct = new QAction(tr("Properties"), this);
    filePropertiesAct->setEnabled(false);
    actionsManager->addAction(filePropertiesAct, "_fileProperties", this, this,
                              SLOT(fileProperties()), QKeySequence("Ctrl+."));

    zoomInAct = new QAction(tr("Zoom In"), this);
    zoomInAct->setEnabled(false);
    actionsManager->addAction(zoomInAct, "_zoomIn", this, this, SLOT(zoomIn()), QKeySequence("+"));

    zoomOutAct = new QAction(tr("Zoom Out"), this);
    zoomOutAct->setEnabled(false);
    actionsManager->addAction(zoomOutAct, "_zoomOut", this, this, SLOT(zoomOut()), QKeySequence("-"));

    normalSizeAct = new QAction(tr("Normal Size"), this);
    normalSizeAct->setEnabled(false);
    actionsManager->addAction(normalSizeAct, "_normalSize", this, this, SLOT(normalSize()), QKeySequence("1"));

    adjustSizeAct = new QAction(tr("Best Fit"), this);
    adjustSizeAct->setEnabled(false);
    adjustSizeAct->setCheckable(true);
    actionsManager->addAction(adjustSizeAct, "_adjustSize", this, this, SLOT(adjustSizeSlot()), QKeySequence("0"));

    rotateRightAct = new QAction(tr("Rotate to right"), this);
    rotateRightAct->setToolTip(tr("Rotate image in the clockwise clock"));
    rotateRightAct->setEnabled(false);
    actionsManager->addAction(rotateRightAct, "_rotateRight", this, this, SLOT(rotateRight()));

    rotateLeftAct = new QAction(tr("Rotate to Left"), this);
    rotateLeftAct->setToolTip(tr("Rotate image counter-clockwise to clockwise"));
    rotateLeftAct->setEnabled(false);
    actionsManager->addAction(rotateLeftAct, "_rotateLeft", this, this, SLOT(rotateLeft()));

    flipVerticallyAct = new QAction(tr("Flip vertically"), this);
    flipVerticallyAct->setToolTip(tr("Turns vertically the image"));
    flipVerticallyAct->setEnabled(false);
    actionsManager->addAction(flipVerticallyAct, "_flipVertically", this, this, SLOT(flipVertically()));

    flipHorizontallyAct = new QAction(tr("Flip horizontally"), this);
    flipHorizontallyAct->setToolTip(tr("Reflects the image"));
    flipHorizontallyAct->setEnabled(false);
    actionsManager->addAction(flipHorizontallyAct, "_flipHorizontally", this, this, SLOT(flipHorizontally()));

    aboutAct = new QAction(tr("A&bout"), this);
    actionsManager->addAction(aboutAct, "_about", this, this, SLOT(about()), QKeySequence::HelpContents);

    nextAct = new QAction(tr("Ne&xt"), this);
    nextAct->setStatusTip(tr("Loads next image"));
    nextAct->setEnabled(false);
    actionsManager->addAction(nextAct, "_next", this, this, SLOT(next()), Qt::Key_Right);

    goFirstAct = new QAction(tr("Go to the first"), this);
    goFirstAct->setStatusTip(tr("Loads the first image in the folder"));
    goFirstAct->setEnabled(false);
    actionsManager->addAction(goFirstAct, "_goFirst", this, this, SLOT(goFirst()), Qt::Key_Home);

    prevAct = new QAction(tr("Pre&vious"), this);
    prevAct->setStatusTip(tr("Loads previous image"));
    prevAct->setEnabled(false);
    actionsManager->addAction(prevAct, "_previous", this, this, SLOT(previous()), Qt::Key_Left);

    goLastAct = new QAction(tr("Go to the last"), this);
    goLastAct->setStatusTip(tr("Loads the last image in the folder"));
    goLastAct->setEnabled(false);
    actionsManager->addAction(goLastAct, "_goLast", this, this, SLOT(goLast()), Qt::Key_End);

    openDirAct = new QAction(tr("Open &Folder"), this);
    openDirAct->setStatusTip("Open a folder to explore images inside it");
    actionsManager->addAction(openDirAct, "_openFolder", this, this, SLOT(openDir()), QKeySequence("Ctrl+Shift+O"));

    showMenuBarAct = new QAction(tr("Show Menu Bar"), this);
    showMenuBarAct->setCheckable(true);
    actionsManager->addAction(showMenuBarAct, "_showMenuBar", this, this, SLOT(showMenuBar()), QKeySequence("Ctrl+M"));

    configAct = new QAction(tr("Configuration"), this);
    configAct->setEnabled(true);
    actionsManager->addAction(configAct, "_configuration", this, this, SLOT(configureProgram()), QKeySequence("Ctrl+C"));

    deleteRecentFilesAct = new QAction(tr("Delete list"), this);
    deleteRecentFilesAct->setIcon(QIcon::fromTheme("edit-clear"));
    connect(deleteRecentFilesAct, SIGNAL(triggered()), this, SLOT(deleteRecentFiles()));

    printAct = new QAction(tr("Print"), this);
    printAct->setEnabled(false);
    actionsManager->addAction(printAct, "_print", this, this, SLOT(print()), QKeySequence::Print);

    deleteFileAct = new QAction(tr("Delete"), this);
    deleteFileAct->setEnabled(false);
    deleteFileAct->setToolTip(tr("This deletes completly the file from the disk, doesn't move it to the trash"));
    actionsManager->addAction(deleteFileAct, "_deleteFile", this, this, SLOT(deleteFileSlot()), QKeySequence::Delete);

    moveToAct = new QAction(tr("Move to..."), this);
    moveToAct->setEnabled(false);
    actionsManager->addAction(moveToAct, "_moveTo", this, this, SLOT(moveToSlot()));

    goToAct = new QAction(tr("Go to"), this);
    goToAct->setEnabled(false);
    actionsManager->addAction(goToAct, "_goTo", this, this, SLOT(goToSlot()), QKeySequence("Ctrl+J"));

    configureToolBarAct = new QAction(tr("Configure toolbar"), this);
    actionsManager->addAction(configureToolBarAct, "_configureToolBar", this, this, SLOT(configureToolBarSlot()));

    //set the icons, becouse QIcon::name() was included in Qt4.7
    actionsManager->setActionIcon("_about", "help-about");
    actionsManager->setActionIcon("_adjustSize", "zoom-fit-best");
    actionsManager->setActionIcon("_configuration", "configure");
    actionsManager->setActionIcon("_deleteFile", "edit-delete");
    actionsManager->setActionIcon("_exit", "application-exit");
    actionsManager->setActionIcon("_fileProperties", "document-properties");
    actionsManager->setActionIcon("_flipHorizontally", "object-flip-horizontal");
    actionsManager->setActionIcon("_flipVertically", "object-flip-vertical");
    actionsManager->setActionIcon("_goFirst", "go-first");
    actionsManager->setActionIcon("_goLast", "go-last");
    actionsManager->setActionIcon("_goTo", "go-jump");
    actionsManager->setActionIcon("_moveTo", "none");
    actionsManager->setActionIcon("_next", "go-next");
    actionsManager->setActionIcon("_normalSize", "zoom-original");
    actionsManager->setActionIcon("_open", "document-open");
    actionsManager->setActionIcon("_openFolder", "folder-open");
    actionsManager->setActionIcon("_previous", "go-previous");
    actionsManager->setActionIcon("_print", "document-print");
    actionsManager->setActionIcon("_rotateLeft", "object-rotate-left");
    actionsManager->setActionIcon("_rotateRight", "object-rotate-right");
    actionsManager->setActionIcon("_save", "document-save");
    actionsManager->setActionIcon("_showMenuBar", "show-menu");
    actionsManager->setActionIcon("_showToolBar", "configure-toolbars");
    actionsManager->setActionIcon("_tbMovable", "configure-toolbars");
    actionsManager->setActionIcon("_configureToolBar", "configure-toolbars");
    actionsManager->setActionIcon("_zoomIn", "zoom-in");
    actionsManager->setActionIcon("_zoomOut", "zoom-out");
}
Exemplo n.º 6
0
void ImageWindow::createActions()
{
    openAction = new QAction(tr("&Open..."), this);
    openAction->setShortcut(tr("Ctrl+O"));
    openAction->setStatusTip(tr("Open an existing image file"));
    connect(openAction, SIGNAL(triggered()), this, SLOT(open()));

    saveAction = new QAction(tr("&Save"), this);
    saveAction->setShortcut(tr("Ctrl+S"));
    saveAction->setStatusTip(tr("Save the image to disk"));
    connect(saveAction, SIGNAL(triggered()), this, SLOT(save()));

    saveAsAction = new QAction(tr("Save &As..."), this);
    saveAsAction->setStatusTip(tr("Save the image under a new name"));
    connect(saveAsAction, SIGNAL(triggered()), this, SLOT(saveAs()));

    exitAction = new QAction(tr("E&xit"), this);
    exitAction->setShortcut(tr("Ctrl+Q"));
    exitAction->setStatusTip(tr("Exit the application"));
    connect(exitAction, SIGNAL(triggered()), this, SLOT(close()));

    flipHorizontallyAction = new QAction(tr("Flip &Horizontally"),
                                         this);
    flipHorizontallyAction->setShortcut(tr("Ctrl+H"));
    flipHorizontallyAction->setStatusTip(tr("Flip the image "
                                         "horizontally"));
    connect(flipHorizontallyAction, SIGNAL(triggered()),
            this, SLOT(flipHorizontally()));

    flipVerticallyAction = new QAction(tr("Flip &Vertically"), this);
    flipVerticallyAction->setShortcut(tr("Ctrl+V"));
    flipVerticallyAction->setStatusTip(tr("Flip the image vertically"));
    connect(flipVerticallyAction, SIGNAL(triggered()),
            this, SLOT(flipVertically()));

    resizeAction = new QAction(tr("&Resize..."), this);
    resizeAction->setShortcut(tr("Ctrl+R"));
    resizeAction->setStatusTip(tr("Resize the image"));
    connect(resizeAction, SIGNAL(triggered()),
            this, SLOT(resizeImage()));

    convertTo32BitAction = new QAction(tr("32 Bit"), this);
    convertTo32BitAction->setStatusTip(tr("Convert to 32-bit image"));
    connect(convertTo32BitAction, SIGNAL(triggered()),
            this, SLOT(convertTo32Bit()));

    convertTo8BitAction = new QAction(tr("8 Bit"), this);
    convertTo8BitAction->setStatusTip(tr("Convert to 8-bit image"));
    connect(convertTo8BitAction, SIGNAL(triggered()),
            this, SLOT(convertTo8Bit()));

    convertTo1BitAction = new QAction(tr("1 Bit"), this);
    convertTo1BitAction->setStatusTip(tr("Convert to 1-bit image"));
    connect(convertTo1BitAction, SIGNAL(triggered()),
            this, SLOT(convertTo1Bit()));

    aboutAction = new QAction(tr("&About"), this);
    aboutAction->setStatusTip(tr("Show the application's About box"));
    connect(aboutAction, SIGNAL(triggered()), this, SLOT(about()));

    aboutQtAction = new QAction(tr("About &Qt"), this);
    aboutQtAction->setStatusTip(tr("Show the Qt library's About box"));
    connect(aboutQtAction, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
}
Exemplo n.º 7
0
void Java_com_lightbox_android_photoprocessing_PhotoProcessing_nativeFlipHorizontally(JNIEnv* env, jobject thiz) {
	flipHorizontally(&bitmap, 1, 1, 1);
}
Exemplo n.º 8
0
void RoombotBuildPlan::turnNinetyDegreesCounterClockwise()
{
    turnAndMirror();
    flipHorizontally();
}
Exemplo n.º 9
0
void Java_editimage_fliter_PhotoProcessing_nativeFlipHorizontally(JNIEnv *env, jobject thiz) {
	flipHorizontally(&bitmap, 1, 1, 1);
}