Exemplo n.º 1
0
void VideoEditor::setSourceFileName(QString sourceFileName)
{
    if (sourceFileName.startsWith("file:"))
        sourceFileName = QUrl(sourceFileName).toLocalFile();

    if (m_video == NULL || m_video->sourceUrl() == sourceFileName)
        return;

    Tardis::instance()->enqueueAction(Tardis::VideoSetSource, m_video->id(), m_video->sourceUrl(), sourceFileName);
    m_video->setSourceUrl(sourceFileName);

    if (m_video->isPicture())
    {
        QPixmap img(sourceFileName);
        if (!img.isNull())
        {
            m_video->setResolution(img.size());
            m_video->setTotalDuration(1000);
            slotMetaDataChanged("Resolution", QVariant(img.size()));
            slotMetaDataChanged("Duration", 1000);
        }
    }
    else
    {
        if (sourceFileName.contains("://"))
            m_mediaPlayer->setMedia(QUrl(sourceFileName));
        else
            m_mediaPlayer->setMedia(QUrl::fromLocalFile(sourceFileName));
    }

    emit sourceFileNameChanged(sourceFileName);
    emit mediaInfoChanged();
    emit functionNameChanged(m_video->name());
    emit loopedChanged();
}
Exemplo n.º 2
0
void FunctionEditor::setFunctionName(QString functionName)
{
    if (m_function == nullptr || m_function->name() == functionName)
        return;

    Tardis::instance()->enqueueAction(Tardis::FunctionSetName, m_function->id(), m_function->name(), functionName);

    m_function->setName(functionName);
    emit functionNameChanged(functionName);
}
Exemplo n.º 3
0
FunctionManager::FunctionManager(QWidget* parent, Doc* doc)
    : QWidget(parent)
    , m_doc(doc)
    , m_hsplitter(NULL)
    , m_vsplitter(NULL)
    , m_tree(NULL)
    , m_toolbar(NULL)
    , m_addSceneAction(NULL)
    , m_addChaserAction(NULL)
    , m_addCollectionAction(NULL)
    , m_addEFXAction(NULL)
    , m_addRGBMatrixAction(NULL)
    , m_addScriptAction(NULL)
    , m_addAudioAction(NULL)
    , m_addVideoAction(NULL)
    , m_autostartAction(NULL)
    , m_wizardAction(NULL)
    , m_addFolderAction(NULL)
    , m_cloneAction(NULL)
    , m_deleteAction(NULL)
    , m_selectAllAction(NULL)
    , m_editor(NULL)
    , m_scene_editor(NULL)
{
    Q_ASSERT(s_instance == NULL);
    s_instance = this;

    Q_ASSERT(doc != NULL);

    new QVBoxLayout(this);
    layout()->setContentsMargins(0, 0, 0, 0);
    layout()->setSpacing(0);

    initActions();
    initToolbar();
    initSplitterView();
    updateActionStatus();

    connect(m_doc, SIGNAL(modeChanged(Doc::Mode)), this, SLOT(slotModeChanged()));
    m_tree->updateTree();

    connect(m_doc, SIGNAL(clearing()), this, SLOT(slotDocClearing()));
    connect(m_doc, SIGNAL(loaded()), this, SLOT(slotDocLoaded()));
    connect(m_doc, SIGNAL(functionNameChanged(quint32)), this, SLOT(slotFunctionNameChanged(quint32)));
    connect(m_doc, SIGNAL(functionAdded(quint32)), this, SLOT(slotFunctionAdded(quint32)));

    QSettings settings;
    QVariant var = settings.value(SETTINGS_SPLITTER);
    if (var.isValid() == true)
        m_hsplitter->restoreState(var.toByteArray());
    else
        m_hsplitter->setSizes(QList <int> () << int(this->width() / 2) << int(this->width() / 2));
}
Exemplo n.º 4
0
void AudioEditor::setSourceFileName(QString sourceFileName)
{
    if (sourceFileName.startsWith("file:"))
        sourceFileName = QUrl(sourceFileName).toLocalFile();

    if (m_audio == nullptr || m_audio->getSourceFileName() == sourceFileName)
        return;

    Tardis::instance()->enqueueAction(Tardis::AudioSetSource, m_audio->id(), m_audio->getSourceFileName(), sourceFileName);
    m_audio->setSourceFileName(sourceFileName);
    emit sourceFileNameChanged(sourceFileName);
    emit mediaInfoChanged();
    emit functionNameChanged(m_audio->name());
    emit loopedChanged();
}
void QuickTestResult::setFunctionName(const QString &name)
{
    Q_D(QuickTestResult);
    if (!name.isEmpty()) {
        // In plain logging mode, we use the function name directly.
        // In XML logging mode, we use "testCase__functionName" as the
        // program name is acting as the class name.
        if (QTestLog::logMode() == QTestLog::Plain ||
                d->testCaseName.isEmpty()) {
            QTestResult::setCurrentTestFunction
                (d->intern(name).constData());
        } else {
            QString fullName = d->testCaseName + QLatin1String("__") + name;
            QTestResult::setCurrentTestFunction
                (d->intern(fullName).constData());
        }
    } else {
        QTestResult::setCurrentTestFunction(0);
    }
    d->functionName = name;
    emit functionNameChanged();
}
Exemplo n.º 6
0
VCCueList::VCCueList(QWidget* parent, Doc* doc) : VCWidget(parent, doc)
    , m_chaserID(Function::invalidId())
    //, m_chaser(NULL)
    , m_timer(NULL)
    , m_primaryIndex(0)
    , m_secondaryIndex(0)
    , m_primaryLeft(true)
{
    /* Set the class name "VCCueList" as the object name as well */
    setObjectName(VCCueList::staticMetaObject.className());

    /* Create a layout for this widget */
    QGridLayout* grid = new QGridLayout(this);
    grid->setSpacing(2);

    m_linkCheck = new QCheckBox(tr("Link"));
    grid->addWidget(m_linkCheck, 0, 0, 1, 2, Qt::AlignVCenter | Qt::AlignCenter);

    m_sl1TopLabel = new QLabel("100%");
    m_sl1TopLabel->setAlignment(Qt::AlignHCenter);
    grid->addWidget(m_sl1TopLabel, 1, 0, 1, 1);
    m_slider1 = new ClickAndGoSlider();
    m_slider1->setSliderStyleSheet(CNG_DEFAULT_STYLE);
    m_slider1->setFixedWidth(32);
    m_slider1->setRange(0, 100);
    m_slider1->setValue(100);
    grid->addWidget(m_slider1, 2, 0, 1, 1);
    m_sl1BottomLabel = new QLabel("");
    m_sl1BottomLabel->setStyleSheet(cfLabelNoStyle);
    m_sl1BottomLabel->setAlignment(Qt::AlignCenter);
    grid->addWidget(m_sl1BottomLabel, 3, 0, 1, 1);
    connect(m_slider1, SIGNAL(valueChanged(int)),
            this, SLOT(slotSlider1ValueChanged(int)));

    m_sl2TopLabel = new QLabel("0%");
    m_sl2TopLabel->setAlignment(Qt::AlignHCenter);
    grid->addWidget(m_sl2TopLabel, 1, 1, 1, 1);
    m_slider2 = new ClickAndGoSlider();
    m_slider2->setSliderStyleSheet(CNG_DEFAULT_STYLE);
    m_slider2->setFixedWidth(32);
    m_slider2->setRange(0, 100);
    m_slider2->setValue(0);
    m_slider2->setInvertedAppearance(true);
    grid->addWidget(m_slider2, 2, 1, 1, 1);
    m_sl2BottomLabel = new QLabel("");
    m_sl2BottomLabel->setStyleSheet(cfLabelNoStyle);
    m_sl2BottomLabel->setAlignment(Qt::AlignCenter);
    grid->addWidget(m_sl2BottomLabel, 3, 1, 1, 1);
    connect(m_slider2, SIGNAL(valueChanged(int)),
            this, SLOT(slotSlider2ValueChanged(int)));

    slotShowCrossfadePanel(false);

    /* Create a list for scenes (cues) */
    m_tree = new QTreeWidget(this);
    grid->addWidget(m_tree, 0, 2, 3, 1);
    m_tree->setSelectionMode(QAbstractItemView::SingleSelection);
    //m_tree->setAlternatingRowColors(true);
    m_tree->setAllColumnsShowFocus(true);
    m_tree->setRootIsDecorated(false);
    m_tree->setItemsExpandable(false);
    m_tree->header()->setSortIndicatorShown(false);
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
    m_tree->header()->setClickable(false);
    m_tree->header()->setMovable(false);
#else
    m_tree->header()->setSectionsClickable(false);
    m_tree->header()->setSectionsMovable(false);
#endif

    // Make only the notes column editable
    m_tree->setItemDelegateForColumn(COL_NUM, new NoEditDelegate(this));
    m_tree->setItemDelegateForColumn(COL_NAME, new NoEditDelegate(this));
    m_tree->setItemDelegateForColumn(COL_FADEIN, new NoEditDelegate(this));
    m_tree->setItemDelegateForColumn(COL_FADEOUT, new NoEditDelegate(this));
    m_tree->setItemDelegateForColumn(COL_DURATION, new NoEditDelegate(this));

    connect(m_tree, SIGNAL(itemActivated(QTreeWidgetItem*,int)),
            this, SLOT(slotItemActivated(QTreeWidgetItem*)));
    connect(m_tree, SIGNAL(itemChanged(QTreeWidgetItem*,int)),
            this, SLOT(slotItemChanged(QTreeWidgetItem*,int)));

    m_progress = new QProgressBar(this);
    m_progress->setOrientation(Qt::Horizontal);
    m_progress->setStyleSheet(progressDisabledStyle);
    m_progress->setProperty("status", 0);
    m_progress->setFixedHeight(20);
    grid->addWidget(m_progress, 3, 2);

    m_timer = new QTimer(this);
    connect(m_timer, SIGNAL(timeout()),
            this, SLOT(slotProgressTimeout()));

    m_updateTimer = new QTimer(this);
    connect(m_updateTimer, SIGNAL(timeout()),
            this, SLOT(slotUpdateStepList()));
    m_updateTimer->setSingleShot(true);

    /* Create control buttons */
    QHBoxLayout *hbox = new QHBoxLayout();
    hbox->setSpacing(2);

    m_crossfadeButton = new QToolButton(this);
    m_crossfadeButton->setIcon(QIcon(":/slider.png"));
    m_crossfadeButton->setIconSize(QSize(24, 24));
    m_crossfadeButton->setCheckable(true);
    m_crossfadeButton->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
    m_crossfadeButton->setFixedHeight(32);
    m_crossfadeButton->setToolTip(tr("Show/Hide crossfade sliders"));
    connect(m_crossfadeButton, SIGNAL(toggled(bool)),
            this, SLOT(slotShowCrossfadePanel(bool)));
    hbox->addWidget(m_crossfadeButton);

    m_playbackButton = new QToolButton(this);
    m_playbackButton->setIcon(QIcon(":/player_play.png"));
    m_playbackButton->setIconSize(QSize(24, 24));
    m_playbackButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    m_playbackButton->setFixedHeight(32);
    m_playbackButton->setToolTip(tr("Play/Stop Cue list"));
    connect(m_playbackButton, SIGNAL(clicked()), this, SLOT(slotPlayback()));
    hbox->addWidget(m_playbackButton);

    m_previousButton = new QToolButton(this);
    m_previousButton->setIcon(QIcon(":/back.png"));
    m_previousButton->setIconSize(QSize(24, 24));
    m_previousButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    m_previousButton->setFixedHeight(32);
    m_previousButton->setToolTip(tr("Go to previous step in the list"));
    connect(m_previousButton, SIGNAL(clicked()), this, SLOT(slotPreviousCue()));
    hbox->addWidget(m_previousButton);

    m_nextButton = new QToolButton(this);
    m_nextButton->setIcon(QIcon(":/forward.png"));
    m_nextButton->setIconSize(QSize(24, 24));
    m_nextButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    m_nextButton->setFixedHeight(32);
    m_nextButton->setToolTip(tr("Go to next step in the list"));
    connect(m_nextButton, SIGNAL(clicked()), this, SLOT(slotNextCue()));
    hbox->addWidget(m_nextButton);

    grid->addItem(hbox, 4, 2);

    setFrameStyle(KVCFrameStyleSunken);
    setType(VCWidget::CueListWidget);
    setCaption(tr("Cue list"));

    QSettings settings;
    QVariant var = settings.value(SETTINGS_CUELIST_SIZE);
    if (var.isValid() == true)
        resize(var.toSize());
    else
        resize(QSize(300, 220));

    slotModeChanged(m_doc->mode());
    setLiveEdit(m_liveEdit);

    connect(m_doc, SIGNAL(functionRemoved(quint32)),
            this, SLOT(slotFunctionRemoved(quint32)));
    connect(m_doc, SIGNAL(functionChanged(quint32)),
            this, SLOT(slotFunctionChanged(quint32)));
    connect(m_doc, SIGNAL(functionNameChanged(quint32)),
            this, SLOT(slotFunctionNameChanged(quint32)));

    m_nextLatestValue = 0;
    m_previousLatestValue = 0;
    m_playbackLatestValue = 0;
}