TLFrame::TLFrame( QWidget *parent ) : QFrame( parent ) { Q_CHECK_PTR( parent ); //Initializations resize( 10, 24 ); setFrameStyle( QFrame::MenuBarPanel | QFrame::Plain ); parent_widget = parent; is_special = false; is_selected = false; is_used = false; is_last = false; is_key = false; is_offset = false; is_drag_offset = false; is_unknown_motion = false; is_motion = false; has_drawing = false; k_toon = ( Ktoon * )( parent_widget -> parentWidget() -> parentWidget() -> parentWidget() -> parentWidget() -> parentWidget() -> parentWidget() -> parentWidget() ); setPaletteBackgroundColor( *( k_toon -> tlDefaultColor() ) ); right_click_menu = new QPopupMenu( this ); right_click_menu -> setFont( QFont( "helvetica", 10 ) ); right_click_menu -> insertItem( tr( "Create Motion Tween" ), parent, SLOT( slotCreateMotionTween() ) ); right_click_menu -> insertItem( tr( "Remove Motion Tween" ), parent, SLOT( slotRemoveMotionTween() ) ); right_click_menu -> insertSeparator(); right_click_menu -> insertItem( tr( "Add Frames" ), parent, SLOT( slotInsertFrame() ) ); right_click_menu -> insertItem( tr( "Remove Frames" ), parent, SLOT( slotRemoveFrame() ) ); }
TLFrame::TLFrame( TLFrame *in_frame ) { Q_CHECK_PTR( in_frame ); QFrame( in_frame -> parentWidget() ); resize( 10, 24 ); setFrameStyle( QFrame::MenuBarPanel | QFrame::Plain ); parent_widget = in_frame -> parentWidget(); is_special = in_frame -> isSpecial(); is_selected = in_frame -> isSelected(); is_used = in_frame -> isUsed(); is_last = in_frame -> isLast(); is_key = in_frame -> isKey(); is_offset = in_frame -> isOffset(); is_unknown_motion = in_frame -> isUnknownMotion(); is_motion = in_frame -> isMotion(); is_drag_offset = in_frame -> isDragOffset(); has_drawing = in_frame -> hasDrawing(); k_toon = ( Ktoon * )( parent_widget -> parentWidget() -> parentWidget() -> parentWidget() -> parentWidget() -> parentWidget() -> parentWidget() -> parentWidget() ); setPaletteBackgroundColor( *( k_toon -> tlDefaultColor() ) ); right_click_menu = new QPopupMenu( this ); right_click_menu -> setFont( QFont( "helvetica", 10 ) ); right_click_menu -> insertItem( tr( "Create Motion Tween" ), parent_widget, SLOT( slotCreateMotionTween() ) ); right_click_menu -> insertItem( tr( "Remove Motion Tween" ), parent_widget, SLOT( slotRemoveMotionTween() ) ); right_click_menu -> insertSeparator(); right_click_menu -> insertItem( tr( "Add Frames" ), parent_widget, SLOT( slotInsertFrame() ) ); right_click_menu -> insertItem( tr( "Remove Frames" ), parent_widget, SLOT( slotRemoveFrame() ) ); }
StopmotionWidget::StopmotionWidget(MonitorManager *manager, KUrl projectFolder, QList< QAction* > actions, QWidget* parent) : QDialog(parent) , Ui::Stopmotion_UI() , m_projectFolder(projectFolder) , m_captureDevice(NULL) , m_sequenceFrame(0) , m_animatedIndex(-1) , m_animate(false) , m_manager(manager) , m_monitor(new StopmotionMonitor(manager, this)) { //setAttribute(Qt::WA_DeleteOnClose); //HACK: the monitor widget is hidden, it is just used to control the capturedevice from monitormanager m_monitor->setHidden(true); connect(m_monitor, SIGNAL(stopCapture()), this, SLOT(slotStopCapture())); m_manager->appendMonitor(m_monitor); QAction* analyse = new QAction(i18n("Send frames to color scopes"), this); analyse->setCheckable(true); analyse->setChecked(KdenliveSettings::analyse_stopmotion()); connect(analyse, SIGNAL(triggered(bool)), this, SLOT(slotSwitchAnalyse(bool))); QAction* mirror = new QAction(i18n("Mirror display"), this); mirror->setCheckable(true); //mirror->setChecked(KdenliveSettings::analyse_stopmotion()); connect(mirror, SIGNAL(triggered(bool)), this, SLOT(slotSwitchMirror(bool))); addActions(actions); setupUi(this); setWindowTitle(i18n("Stop Motion Capture")); setFont(KGlobalSettings::toolBarFont()); live_button->setIcon(KIcon("camera-photo")); m_captureAction = actions.at(0); connect(m_captureAction, SIGNAL(triggered()), this, SLOT(slotCaptureFrame())); m_captureAction->setCheckable(true); m_captureAction->setChecked(false); capture_button->setDefaultAction(m_captureAction); connect(actions.at(1), SIGNAL(triggered()), this, SLOT(slotSwitchLive())); QAction *intervalCapture = new QAction(i18n("Interval capture"), this); intervalCapture->setIcon(KIcon("chronometer")); intervalCapture->setCheckable(true); intervalCapture->setChecked(false); capture_interval->setDefaultAction(intervalCapture); preview_button->setIcon(KIcon("media-playback-start")); capture_button->setEnabled(false); // Build config menu QMenu* confMenu = new QMenu; m_showOverlay = actions.at(2); connect(m_showOverlay, SIGNAL(triggered(bool)), this, SLOT(slotShowOverlay(bool))); overlay_button->setDefaultAction(m_showOverlay); //confMenu->addAction(m_showOverlay); m_effectIndex = KdenliveSettings::stopmotioneffect(); QMenu* effectsMenu = new QMenu(i18n("Overlay effect")); QActionGroup* effectGroup = new QActionGroup(this); QAction* noEffect = new QAction(i18n("No Effect"), effectGroup); noEffect->setData(0); QAction* contrastEffect = new QAction(i18n("Contrast"), effectGroup); contrastEffect->setData(1); QAction* edgeEffect = new QAction(i18n("Edge detect"), effectGroup); edgeEffect->setData(2); QAction* brightEffect = new QAction(i18n("Brighten"), effectGroup); brightEffect->setData(3); QAction* invertEffect = new QAction(i18n("Invert"), effectGroup); invertEffect->setData(4); QAction* thresEffect = new QAction(i18n("Threshold"), effectGroup); thresEffect->setData(5); effectsMenu->addAction(noEffect); effectsMenu->addAction(contrastEffect); effectsMenu->addAction(edgeEffect); effectsMenu->addAction(brightEffect); effectsMenu->addAction(invertEffect); effectsMenu->addAction(thresEffect); QList <QAction*> list = effectsMenu->actions(); for (int i = 0; i < list.count(); i++) { list.at(i)->setCheckable(true); if (list.at(i)->data().toInt() == m_effectIndex) { list.at(i)->setChecked(true); } } connect(effectsMenu, SIGNAL(triggered(QAction*)), this, SLOT(slotUpdateOverlayEffect(QAction*))); confMenu->addMenu(effectsMenu); QAction* showThumbs = new QAction(KIcon("image-x-generic"), i18n("Show sequence thumbnails"), this); showThumbs->setCheckable(true); showThumbs->setChecked(KdenliveSettings::showstopmotionthumbs()); connect(showThumbs, SIGNAL(triggered(bool)), this, SLOT(slotShowThumbs(bool))); QAction* removeCurrent = new QAction(KIcon("edit-delete"), i18n("Delete current frame"), this); removeCurrent->setShortcut(Qt::Key_Delete); connect(removeCurrent, SIGNAL(triggered()), this, SLOT(slotRemoveFrame())); QAction* conf = new QAction(KIcon("configure"), i18n("Configure"), this); connect(conf, SIGNAL(triggered()), this, SLOT(slotConfigure())); confMenu->addAction(showThumbs); confMenu->addAction(removeCurrent); confMenu->addAction(analyse); confMenu->addAction(mirror); confMenu->addAction(conf); config_button->setIcon(KIcon("configure")); config_button->setMenu(confMenu); connect(sequence_name, SIGNAL(textChanged(const QString&)), this, SLOT(sequenceNameChanged(const QString&))); connect(sequence_name, SIGNAL(currentIndexChanged(int)), live_button, SLOT(setFocus())); // Video widget holder QVBoxLayout *layout = new QVBoxLayout; layout->setContentsMargins(0, 0, 0, 0); layout->setSpacing(0); m_monitor->videoBox->setLineWidth(4); layout->addWidget(m_monitor->videoBox); if (KdenliveSettings::decklink_device_found()) { // Found a BlackMagic device } if (QFile::exists(KdenliveSettings::video4vdevice())) { #ifdef USE_V4L // Video 4 Linux device detection for (int i = 0; i < 10; i++) { QString path = "/dev/video" + QString::number(i); if (QFile::exists(path)) { QStringList deviceInfo = V4lCaptureHandler::getDeviceName(path); if (!deviceInfo.isEmpty()) { capture_device->addItem(deviceInfo.at(0), "v4l"); capture_device->setItemData(capture_device->count() - 1, path, Qt::UserRole + 1); capture_device->setItemData(capture_device->count() - 1, deviceInfo.at(1), Qt::UserRole + 2); if (path == KdenliveSettings::video4vdevice()) capture_device->setCurrentIndex(capture_device->count() - 1); } } } #endif /* USE_V4L */ } connect(capture_device, SIGNAL(currentIndexChanged(int)), this, SLOT(slotUpdateDeviceHandler())); /*if (m_bmCapture) { connect(m_bmCapture, SIGNAL(frameSaved(const QString &)), this, SLOT(slotNewThumb(const QString &))); connect(m_bmCapture, SIGNAL(gotFrame(QImage)), this, SIGNAL(gotFrame(QImage))); } else live_button->setEnabled(false);*/ m_frame_preview = new MyLabel(this); connect(m_frame_preview, SIGNAL(seek(bool)), this, SLOT(slotSeekFrame(bool))); connect(m_frame_preview, SIGNAL(switchToLive()), this, SLOT(slotSwitchLive())); layout->addWidget(m_frame_preview); m_frame_preview->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); video_preview->setLayout(layout); //kDebug()<<video_preview->winId(); QString profilePath; // Create MLT producer data if (capture_device->itemData(capture_device->currentIndex()) == "v4l") { // Capture using a video4linux device profilePath = KStandardDirs::locateLocal("appdata", "profiles/video4linux"); } else { // Decklink capture profilePath = KdenliveSettings::current_profile(); } m_captureDevice = new MltDeviceCapture(profilePath, m_monitor->videoSurface, this); m_captureDevice->sendFrameForAnalysis = KdenliveSettings::analyse_stopmotion(); m_monitor->setRender(m_captureDevice); connect(m_captureDevice, SIGNAL(frameSaved(const QString &)), this, SLOT(slotNewThumb(const QString &))); live_button->setChecked(false); button_addsequence->setEnabled(false); connect(live_button, SIGNAL(toggled(bool)), this, SLOT(slotLive(bool))); connect(button_addsequence, SIGNAL(clicked(bool)), this, SLOT(slotAddSequence())); connect(preview_button, SIGNAL(clicked(bool)), this, SLOT(slotPlayPreview(bool))); connect(frame_list, SIGNAL(currentRowChanged(int)), this, SLOT(slotShowSelectedFrame())); connect(frame_list, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(slotShowSelectedFrame())); connect(this, SIGNAL(doCreateThumbs(QImage, int)), this, SLOT(slotCreateThumbs(QImage, int))); frame_list->addAction(removeCurrent); frame_list->setContextMenuPolicy(Qt::ActionsContextMenu); frame_list->setHidden(!KdenliveSettings::showstopmotionthumbs()); parseExistingSequences(); QTimer::singleShot(500, this, SLOT(slotLive())); connect(&m_intervalTimer, SIGNAL(timeout()), this, SLOT(slotCaptureFrame())); m_intervalTimer.setSingleShot(true); m_intervalTimer.setInterval(KdenliveSettings::captureinterval() * 1000); }
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 }