void VCFrame::invokeMenu(QPoint point) { // // Add menu // QPopupMenu* addMenu = new QPopupMenu(); addMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/button.xpm")), "&Button", KVCMenuAddButton); addMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/slider.xpm")), "&Slider", KVCMenuAddSlider); addMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/frame.xpm")), "&Frame", KVCMenuAddFrame); addMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/xypad.xpm")), "&XY-Pad", KVCMenuAddXYPad); addMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/label.xpm")), "L&abel", KVCMenuAddLabel); QPopupMenu* menu = new QPopupMenu(); // Insert common stuff from virtual console (100% dirty hack) menu->insertItem("Edit", _app->virtualConsole()->editMenu()); // Insert the add menu menu->insertItem("Add", addMenu); switch(menu->exec(point)) { case KVCMenuAddButton: slotAddButton(mapFromGlobal(point)); break; case KVCMenuAddSlider: slotAddSlider(mapFromGlobal(point)); break; case KVCMenuAddFrame: slotAddFrame(mapFromGlobal(point)); break; case KVCMenuAddXYPad: slotAddXYPad(mapFromGlobal(point)); break; case KVCMenuAddLabel: slotAddLabel(mapFromGlobal(point)); break; default: break; } delete addMenu; delete menu; }
void VirtualConsole::initMenuBar() { QString dir; _app->settings()->get(KEY_SYSTEM_DIR, dir); dir += QString("/") + PIXMAPPATH; setIcon(dir + QString("/virtualconsole.xpm")); m_layout = new QHBoxLayout(this); m_layout->setAutoAdd(false); m_menuBar = new QMenuBar(this); m_layout->setMenuBar(m_menuBar); // // Add menu // m_addMenu = new QPopupMenu(); m_addMenu->insertItem(QPixmap(dir + "/button.xpm"), "&Button", this, SLOT(slotAddButton()), 0, KVCMenuAddButton); m_addMenu->insertItem(QPixmap(dir + "/slider.xpm"), "&Slider", this, SLOT(slotAddSlider()), 0, KVCMenuAddSlider); m_addMenu->insertItem(QPixmap(dir + "/frame.xpm"), "&Frame", this, SLOT(slotAddFrame()), 0, KVCMenuAddFrame); m_addMenu->insertItem(QPixmap(dir + "/frame.xpm"), "&XY-Pad", this, SLOT(slotAddXYPad()), 0, KVCMenuAddXYPad); m_addMenu->setItemEnabled(KVCMenuAddXYPad, false); m_addMenu->insertItem(QPixmap(dir + "/rename.xpm"), "L&abel", this, SLOT(slotAddLabel()), 0, KVCMenuAddLabel); // // Tools menu // m_toolsMenu = new QPopupMenu(); m_toolsMenu->insertItem(QPixmap(dir + "/settings.xpm"), "&Settings...", this, SLOT(slotToolsSettings()), 0, KVCMenuToolsSettings); m_toolsMenu->insertItem(QPixmap(dir + "/slider.xpm"), "&Default Sliders", this, SLOT(slotToolsSliders()), 0, KVCMenuToolsSliders); m_toolsMenu->insertSeparator(); m_toolsMenu->insertItem(QPixmap(dir + "/panic.xpm"), "&Panic!", this, SLOT(slotToolsPanic()), 0, KVCMenuToolsPanic); // // Foreground menu // QPopupMenu* fgMenu = new QPopupMenu(); fgMenu->insertItem(QPixmap(dir + QString("/color.xpm")), "&Color...", this, SLOT(slotForegroundColor()), 0, KVCMenuForegroundColor); fgMenu->insertItem(QPixmap(dir + QString("/rename.xpm")), "&Font...", this, SLOT(slotForegroundFont()), 0, KVCMenuForegroundFont); fgMenu->insertItem(QPixmap(dir + QString("/fileclose.xpm")), "&Default", this, SLOT(slotForegroundNone()), 0, KVCMenuForegroundNone); // // Background Menu // QPopupMenu* bgMenu = new QPopupMenu(); bgMenu->insertItem(QPixmap(dir + QString("/color.xpm")), "&Color...", this, SLOT(slotBackgroundColor()), 0, KVCMenuBackgroundColor); bgMenu->insertItem(QPixmap(dir + QString("/image.xpm")), "&Image...", this, SLOT(slotBackgroundImage()), 0, KVCMenuBackgroundPixmap); bgMenu->insertItem(QPixmap(dir + QString("/fileclose.xpm")), "&Default", this, SLOT(slotBackgroundNone()), 0, KVCMenuBackgroundNone); bgMenu->insertSeparator(); bgMenu->insertItem(QPixmap(dir + QString("/frame.xpm")), "Toggle &Frame", this, SLOT(slotBackgroundFrame()), 0, KVCMenuBackgroundFrame); // // Stacking order menu // QPopupMenu* stackMenu = new QPopupMenu(); stackMenu->insertItem(QPixmap(dir + QString("/up.xpm")), "&Raise", this, SLOT(slotStackingRaise()), 0, KVCMenuStackingRaise); stackMenu->insertItem(QPixmap(dir + QString("/down.xpm")), "&Lower", this, SLOT(slotStackingLower()), 0, KVCMenuStackingLower); // // Edit menu // m_editMenu = new QPopupMenu(); m_editMenu->insertItem(QPixmap(dir + "/editcut.xpm"), "Cut", this, SLOT(slotEditCut()), 0, KVCMenuEditCut); m_editMenu->insertItem(QPixmap(dir + "/editcopy.xpm"), "Copy", this, SLOT(slotEditCopy()), 0, KVCMenuEditCopy); m_editMenu->insertItem(QPixmap(dir + "/editpaste.xpm"), "Paste", this, SLOT(slotEditPaste()), 0, KVCMenuEditPaste); m_editMenu->insertItem(QPixmap(dir + "/remove.xpm"), "Delete", this, SLOT(slotEditDelete()), 0, KVCMenuEditDelete); m_editMenu->insertSeparator(); m_editMenu->insertItem(QPixmap(dir + "/settings.xpm"), "&Properties...", this, SLOT(slotEditProperties()), 0, KVCMenuEditProperties); m_editMenu->insertItem(QPixmap(dir + QString("/rename.xpm")), "&Rename...", this, SLOT(slotEditRename()), 0, KVCMenuEditRename); m_editMenu->setItemEnabled(KVCMenuEditCut, false); m_editMenu->setItemEnabled(KVCMenuEditCopy, false); m_editMenu->setItemEnabled(KVCMenuEditPaste, false); m_editMenu->insertSeparator(); m_editMenu->insertItem("Foreground", fgMenu, KVCMenuForegroundMin); m_editMenu->insertItem("Background", bgMenu, KVCMenuBackgroundMin); m_editMenu->insertItem("Stacking Order", stackMenu, KVCMenuStackingMin); m_menuBar->insertItem("&Tools", m_toolsMenu); m_menuBar->insertItem("&Add", m_addMenu); m_menuBar->insertItem("&Edit", m_editMenu); }
AbstractConfig::AbstractConfig(AbstractContent * content, AbstractConfig_PARENT * parent) : AbstractConfig_TYPE(parent) , m_content(content) , m_commonUi(new Ui::AbstractConfig()) #if !defined(MOBILE_UI) , m_closeButton(0) , m_okButton(0) #endif , m_frame(FrameFactory::defaultPanelFrame()) { #if !defined(MOBILE_UI) // close button m_closeButton = new StyledButtonItem(tr(" x "), font(), this);//this, ":/data/button-close.png", ":/data/button-close-hovered.png", ":/data/button-close-pressed.png"); connect(m_closeButton, SIGNAL(clicked()), this, SIGNAL(requestClose())); // WIDGET setup (populate contents and set base palette (only) to transparent) QWidget * widget = new QWidget(); m_commonUi->setupUi(widget); QPalette pal; QColor oldColor = pal.window().color(); pal.setBrush(QPalette::Window, Qt::transparent); widget->setPalette(pal); pal.setBrush(QPalette::Window, oldColor); m_commonUi->tab->setPalette(pal); #else m_commonUi->setupUi(this); #endif populateFrameList(); // select the frame quint32 frameClass = m_content->frameClass(); if (frameClass != Frame::NoFrame) { for (int i = 0; i < m_commonUi->framesList->count(); ++i) { QListWidgetItem * item = m_commonUi->framesList->item(i); if (item->data(Qt::UserRole).toUInt() == frameClass) { item->setSelected(true); break; } } } // read other properties m_commonUi->reflection->setChecked(m_content->mirrored()); m_commonUi->contentLocked->setChecked(m_content->locked()); m_commonUi->fixedPosition->setChecked(m_content->fixedPosition()); m_commonUi->fixedRotation->setChecked(m_content->fixedRotation()); m_commonUi->fixedPerspective->setChecked(m_content->fixedPerspective()); connect(m_commonUi->front, SIGNAL(clicked()), m_content, SLOT(slotStackFront())); connect(m_commonUi->raise, SIGNAL(clicked()), m_content, SLOT(slotStackRaise())); connect(m_commonUi->lower, SIGNAL(clicked()), m_content, SLOT(slotStackLower())); connect(m_commonUi->back, SIGNAL(clicked()), m_content, SLOT(slotStackBack())); connect(m_commonUi->save, SIGNAL(clicked()), m_content, SLOT(slotSaveAs())); connect(m_commonUi->background, SIGNAL(clicked()), m_content, SIGNAL(requestBackgrounding())); connect(m_commonUi->del, SIGNAL(clicked()), m_content, SIGNAL(requestRemoval())); connect(m_commonUi->contentLocked, SIGNAL(stateChanged(int)), m_content, SLOT(slotSetLocked(int))); connect(m_commonUi->fixedPosition, SIGNAL(stateChanged(int)), m_content, SLOT(slotSetFixedPosition(int))); connect(m_commonUi->fixedRotation, SIGNAL(stateChanged(int)), m_content, SLOT(slotSetFixedRotation(int))); connect(m_commonUi->fixedPerspective, SIGNAL(stateChanged(int)), m_content, SLOT(slotSetFixedPerspective(int))); connect(m_commonUi->newFrame, SIGNAL(clicked()), this, SLOT(slotAddFrame())); connect(m_commonUi->removeFrame, SIGNAL(clicked()), this, SLOT(slotRemoveFrame())); connect(m_commonUi->lookApplyAll, SIGNAL(clicked()), this, SLOT(slotLookApplyAll())); connect(m_commonUi->framesList, SIGNAL(itemSelectionChanged()), this, SLOT(slotFrameSelectionChanged())); connect(m_commonUi->reflection, SIGNAL(toggled(bool)), this, SLOT(slotReflectionToggled(bool))); // ITEM setup #if !defined(MOBILE_UI) setFlag(QGraphicsItem::ItemIgnoresTransformations, true); setWidget(widget); static qreal s_propZBase = 99999; setZValue(s_propZBase++); #endif #if !defined(MOBILE_UI) && QT_VERSION >= 0x040600 // fade in animation QPropertyAnimation * ani = new QPropertyAnimation(this, "opacity"); ani->setEasingCurve(QEasingCurve::OutCubic); ani->setDuration(400); ani->setStartValue(0.0); ani->setEndValue(1.0); ani->start(QPropertyAnimation::DeleteWhenStopped); #endif }
Geometryval::Geometryval(const MltVideoProfile profile, QPoint frame_size, QWidget* parent) : QWidget(parent), m_profile(profile), m_paramRect(NULL), m_geom(NULL), m_path(NULL), m_fixedMode(false), m_frameSize(frame_size) { m_ui.setupUi(this); QVBoxLayout* vbox = new QVBoxLayout(m_ui.widget); QGraphicsView *view = new QGraphicsView(this); view->setBackgroundBrush(QBrush(Qt::black)); vbox->addWidget(view); vbox->setContentsMargins(0, 0, 0, 0); QVBoxLayout* vbox2 = new QVBoxLayout(m_ui.keyframeWidget); m_helper = new KeyframeHelper(this); vbox2->addWidget(m_helper); vbox2->setContentsMargins(0, 0, 0, 0); connect(m_helper, SIGNAL(positionChanged(int)), this, SLOT(slotPositionChanged(int))); m_scene = new GraphicsSceneRectMove(this); m_scene->setTool(TITLE_SELECT); view->setScene(m_scene); QGraphicsRectItem *m_frameBorder = new QGraphicsRectItem(QRectF(0, 0, profile.width, profile.height)); m_frameBorder->setZValue(-1100); m_frameBorder->setBrush(QColor(255, 255, 0, 30)); m_frameBorder->setPen(QPen(QBrush(QColor(255, 255, 255, 255)), 1.0, Qt::DashLine)); m_scene->addItem(m_frameBorder); m_ui.buttonNext->setIcon(KIcon("media-skip-forward")); m_ui.buttonNext->setToolTip(i18n("Go to next keyframe")); m_ui.buttonPrevious->setIcon(KIcon("media-skip-backward")); m_ui.buttonPrevious->setToolTip(i18n("Go to previous keyframe")); m_ui.buttonAdd->setIcon(KIcon("document-new")); m_ui.buttonAdd->setToolTip(i18n("Add keyframe")); m_ui.buttonDelete->setIcon(KIcon("edit-delete")); m_ui.buttonDelete->setToolTip(i18n("Delete keyframe")); QMenu *configMenu = new QMenu(i18n("Misc..."), this); m_ui.buttonMenu->setIcon(KIcon("system-run")); m_ui.buttonMenu->setMenu(configMenu); m_ui.buttonMenu->setPopupMode(QToolButton::QToolButton::InstantPopup); configMenu->addAction(i18n("Geometry"), this, SLOT(slotGeometry())); m_scaleMenu = new QMenu(i18n("Resize..."), this); configMenu->addMenu(m_scaleMenu); m_scaleMenu->addAction(i18n("50%"), this, SLOT(slotResize50())); m_scaleMenu->addAction(i18n("100%"), this, SLOT(slotResize100())); m_scaleMenu->addAction(i18n("200%"), this, SLOT(slotResize200())); m_scaleMenu->addAction(i18n("Original size"), this, SLOT(slotResizeOriginal())); m_scaleMenu->addAction(i18n("Custom"), this, SLOT(slotResizeCustom())); m_alignMenu = new QMenu(i18n("Align..."), this); configMenu->addMenu(m_alignMenu); m_alignMenu->addAction(i18n("Center"), this, SLOT(slotAlignCenter())); m_alignMenu->addAction(i18n("Hor. Center"), this, SLOT(slotAlignHCenter())); m_alignMenu->addAction(i18n("Vert. Center"), this, SLOT(slotAlignVCenter())); m_alignMenu->addAction(i18n("Right"), this, SLOT(slotAlignRight())); m_alignMenu->addAction(i18n("Left"), this, SLOT(slotAlignLeft())); m_alignMenu->addAction(i18n("Top"), this, SLOT(slotAlignTop())); m_alignMenu->addAction(i18n("Bottom"), this, SLOT(slotAlignBottom())); m_syncAction = configMenu->addAction(i18n("Sync timeline cursor"), this, SLOT(slotSyncCursor())); m_syncAction->setCheckable(true); m_syncAction->setChecked(KdenliveSettings::transitionfollowcursor()); //scene->setSceneRect(0, 0, profile.width * 2, profile.height * 2); //view->fitInView(m_frameBorder, Qt::KeepAspectRatio); const double sc = 100.0 / profile.height * 0.8; QRectF srect = view->sceneRect(); view->setSceneRect(srect.x(), -srect.height() / 3 + 10, srect.width(), srect.height() + srect.height() / 3 * 2 - 10); m_scene->setZoom(sc); view->centerOn(m_frameBorder); connect(m_ui.buttonNext , SIGNAL(clicked()) , this , SLOT(slotNextFrame())); connect(m_ui.buttonPrevious , SIGNAL(clicked()) , this , SLOT(slotPreviousFrame())); connect(m_ui.buttonDelete , SIGNAL(clicked()) , this , SLOT(slotDeleteFrame())); connect(m_ui.buttonAdd , SIGNAL(clicked()) , this , SLOT(slotAddFrame())); connect(m_scene, SIGNAL(actionFinished()), this, SLOT(slotUpdateTransitionProperties())); connect(m_scene, SIGNAL(doubleClickEvent()), this, SLOT(slotGeometry())); }
Geometryval::Geometryval(const Mlt::Profile *profile, const Timecode &t, const QPoint &frame_size, int startPoint, QWidget* parent) : QWidget(parent), m_profile(profile), m_paramRect(NULL), m_geom(NULL), m_path(NULL), m_fixedMode(false), m_frameSize(frame_size), m_startPoint(startPoint), m_timePos(t) { setupUi(this); toolbarlayout->addWidget(&m_timePos); toolbarlayout->insertStretch(-1); QVBoxLayout* vbox = new QVBoxLayout(widget); m_sceneview = new QGraphicsView(this); m_sceneview->setBackgroundBrush(QBrush(Qt::black)); vbox->addWidget(m_sceneview); vbox->setContentsMargins(0, 0, 0, 0); QVBoxLayout* vbox2 = new QVBoxLayout(keyframeWidget); m_helper = new KeyframeHelper(this); vbox2->addWidget(m_helper); vbox2->setContentsMargins(0, 0, 0, 0); connect(m_helper, SIGNAL(positionChanged(int)), this, SLOT(slotPositionChanged(int))); connect(m_helper, SIGNAL(keyframeMoved(int)), this, SLOT(slotKeyframeMoved(int))); connect(m_helper, SIGNAL(addKeyframe(int)), this, SLOT(slotAddFrame(int))); connect(m_helper, SIGNAL(removeKeyframe(int)), this, SLOT(slotDeleteFrame(int))); m_scene = new GraphicsSceneRectMove(this); m_scene->setTool(TITLE_SELECT); m_sceneview->setScene(m_scene); m_dar = (m_profile->height() * m_profile->dar()) / (double) m_profile->width(); m_realWidth = (int)(profile->height() * profile->dar() + 0.5); QGraphicsRectItem *frameBorder = new QGraphicsRectItem(QRectF(0, 0, m_realWidth, profile->height())); frameBorder->setZValue(-1100); frameBorder->setBrush(QColor(255, 255, 0, 30)); frameBorder->setPen(QPen(QBrush(QColor(255, 255, 255, 255)), 1.0, Qt::DashLine)); m_scene->addItem(frameBorder); buttonNext->setIcon(QIcon::fromTheme("media-skip-forward")); buttonNext->setToolTip(i18n("Go to next keyframe")); buttonPrevious->setIcon(QIcon::fromTheme("media-skip-backward")); buttonPrevious->setToolTip(i18n("Go to previous keyframe")); buttonAdd->setIcon(QIcon::fromTheme("document-new")); buttonAdd->setToolTip(i18n("Add keyframe")); buttonDelete->setIcon(QIcon::fromTheme("edit-delete")); buttonDelete->setToolTip(i18n("Delete keyframe")); m_configMenu = new QMenu(i18n("Misc..."), this); buttonMenu->setMenu(m_configMenu); buttonMenu->setPopupMode(QToolButton::MenuButtonPopup); m_editOptions = m_configMenu->addAction(QIcon::fromTheme("system-run"), i18n("Show/Hide options")); m_editOptions->setCheckable(true); buttonMenu->setDefaultAction(m_editOptions); connect(m_editOptions, SIGNAL(triggered()), this, SLOT(slotSwitchOptions())); slotSwitchOptions(); m_reset = m_configMenu->addAction(QIcon::fromTheme("view-refresh"), i18n("Reset"), this, SLOT(slotResetPosition())); m_syncAction = m_configMenu->addAction(i18n("Sync timeline cursor"), this, SLOT(slotSyncCursor())); m_syncAction->setCheckable(true); m_syncAction->setChecked(KdenliveSettings::transitionfollowcursor()); //scene->setSceneRect(0, 0, profile->width * 2, profile->height * 2); //view->fitInView(m_frameBorder, Qt::KeepAspectRatio); const double sc = 100.0 / profile->height() * 0.8; QRectF srect = m_sceneview->sceneRect(); m_sceneview->setSceneRect(srect.x(), -srect.height() / 3 + 10, srect.width(), srect.height() + srect.height() / 3 * 2 - 10); m_scene->setZoom(sc); m_sceneview->centerOn(frameBorder); m_sceneview->setMouseTracking(true); connect(buttonNext , SIGNAL(clicked()) , this , SLOT(slotNextFrame())); connect(buttonPrevious , SIGNAL(clicked()) , this , SLOT(slotPreviousFrame())); connect(buttonDelete , SIGNAL(clicked()) , this , SLOT(slotDeleteFrame())); connect(buttonAdd , SIGNAL(clicked()) , this , SLOT(slotAddFrame())); connect(m_scene, SIGNAL(actionFinished()), this, SLOT(slotUpdateTransitionProperties())); buttonhcenter->setIcon(QIcon::fromTheme("kdenlive-align-hor")); buttonhcenter->setToolTip(i18n("Align item horizontally")); buttonvcenter->setIcon(QIcon::fromTheme("kdenlive-align-vert")); buttonvcenter->setToolTip(i18n("Align item vertically")); buttontop->setIcon(QIcon::fromTheme("kdenlive-align-top")); buttontop->setToolTip(i18n("Align item to top")); buttonbottom->setIcon(QIcon::fromTheme("kdenlive-align-bottom")); buttonbottom->setToolTip(i18n("Align item to bottom")); buttonright->setIcon(QIcon::fromTheme("kdenlive-align-right")); buttonright->setToolTip(i18n("Align item to right")); buttonleft->setIcon(QIcon::fromTheme("kdenlive-align-left")); buttonleft->setToolTip(i18n("Align item to left")); connect(buttonhcenter, SIGNAL(clicked()), this, SLOT(slotAlignHCenter())); connect(buttonvcenter, SIGNAL(clicked()), this, SLOT(slotAlignVCenter())); connect(buttontop, SIGNAL(clicked()), this, SLOT(slotAlignTop())); connect(buttonbottom, SIGNAL(clicked()), this, SLOT(slotAlignBottom())); connect(buttonright, SIGNAL(clicked()), this, SLOT(slotAlignRight())); connect(buttonleft, SIGNAL(clicked()), this, SLOT(slotAlignLeft())); connect(spinX, SIGNAL(valueChanged(int)), this, SLOT(slotGeometryX(int))); connect(spinY, SIGNAL(valueChanged(int)), this, SLOT(slotGeometryY(int))); connect(spinWidth, SIGNAL(valueChanged(int)), this, SLOT(slotGeometryWidth(int))); connect(spinHeight, SIGNAL(valueChanged(int)), this, SLOT(slotGeometryHeight(int))); connect(spinResize, SIGNAL(editingFinished()), this, SLOT(slotResizeCustom())); connect(buttonResize, SIGNAL(clicked()), this, SLOT(slotResizeOriginal())); connect(this, SIGNAL(parameterChanged()), this, SLOT(slotUpdateGeometry())); }