KCMKTECollaborative::KCMKTECollaborative(QWidget* parent, const QVariantList& args)
    : KCModule(KteCollaborativePluginFactory::componentData(), parent, args)
{
    kDebug() << "creating kte_collaborative kcmodule";
    // Set up config groups
    KConfig* config = new KConfig("ktecollaborative");
    m_colorsGroup = config->group("colors");
    m_notifyGroup = config->group("notifications");
    m_applicationsGroup = config->group("applications");

    // Create notifications group box
    QGroupBox* notificationsGroupBox = new QGroupBox();
    notificationsGroupBox->setTitle(i18n("Highlights and Notifications"));
    QVBoxLayout* notificationsLayout = new QVBoxLayout();
    notificationsGroupBox->setLayout(notificationsLayout);
    m_highlightBackground = new QCheckBox(i18n("Display popup widgets"));
    m_displayWidgets = new QCheckBox(i18n("Colorize text background"));
    m_displayTextHints = new QCheckBox(i18n("Display text tooltips"));
    notificationsLayout->addWidget(m_displayWidgets);
    notificationsLayout->addWidget(m_highlightBackground);
    notificationsLayout->addWidget(m_displayTextHints);

    // Create colors group box
    QGroupBox* colorsGroupBox = new QGroupBox();
    colorsGroupBox->setTitle(i18n("Colors"));
    QFormLayout* colorsLayout = new QFormLayout();
    colorsGroupBox->setLayout(colorsLayout);
    m_saturationSilder = new QSlider(Qt::Horizontal);
    m_saturationSilder->setRange(30, 255);
    colorsLayout->addRow(i18n("Highlight saturation"), m_saturationSilder);

    // Create default application group box
    QGroupBox* defaultApplicationBox = new QGroupBox();
    defaultApplicationBox->setTitle(i18n("Default application"));
    defaultApplicationBox->setLayout(new QHBoxLayout);
    m_selectEditorWidget = new SelectEditorWidget(m_applicationsGroup.readEntry("editor"));
    defaultApplicationBox->layout()->addWidget(m_selectEditorWidget);

    // Assemble the UI
    setLayout(new QVBoxLayout());
    KMessageWidget* message = new KMessageWidget(i18n("Some changes might only be applied for newly opened documents."));
    message->setMessageType(KMessageWidget::Information);
    message->setCloseButtonVisible(false);
    layout()->addWidget(message);
    layout()->addWidget(notificationsGroupBox);
    layout()->addWidget(colorsGroupBox);
    layout()->addWidget(defaultApplicationBox);
    // Add a spacer to top-align the widgets
    layout()->addItem(new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Expanding));

    // Set up connections for changed signals
    connect(m_saturationSilder, SIGNAL(sliderMoved(int)), SLOT(changed()));
    connect(m_highlightBackground, SIGNAL(toggled(bool)), SLOT(changed()));
    connect(m_displayWidgets, SIGNAL(toggled(bool)), SLOT(changed()));
    connect(m_displayTextHints, SIGNAL(toggled(bool)), SLOT(changed()));
    connect(m_selectEditorWidget, SIGNAL(selectionChanged()), SLOT(changed()));
}
Exemplo n.º 2
0
AudioGraphSpectrum::AudioGraphSpectrum(MonitorManager *manager, QWidget *parent) : QWidget(parent)
    , m_manager(manager)
    , m_filter(0)
    , m_graphWidget(0)
{
    QVBoxLayout *lay = new QVBoxLayout(this);
    m_graphWidget = new AudioGraphWidget(this);
    lay->addWidget(m_graphWidget);
    Mlt::Profile profile;
    m_filter = new Mlt::Filter(profile, "fft");
    if (!m_filter->is_valid()) {
        KdenliveSettings::setEnableaudiospectrum(false);
        KMessageWidget *mw = new KMessageWidget(this);
        mw->setCloseButtonVisible(false);
        mw->setWordWrap(true);
        mw->setMessageType(KMessageWidget::Information);
        mw->setText(i18n("MLT must be compiled with libfftw3 to enable Audio Spectrum"));
        lay->addWidget(mw);
        mw->show();
        setEnabled(false);
        return;
    }
    /*m_equalizer = new EqualizerWidget(this);
    lay->addWidget(m_equalizer);
    lay->setStretchFactor(m_graphWidget, 5);
    lay->setStretchFactor(m_equalizer, 3);*/

    m_filter->set("window_size", WINDOW_SIZE);
    connect(m_manager, &MonitorManager::updateAudioSpectrum, this, &AudioGraphSpectrum::processSpectrum);
    QAction *a = new QAction(i18n("Enable Audio Spectrum"), this);
    a->setCheckable(true);
    a->setChecked(KdenliveSettings::enableaudiospectrum());
    connect(a, &QAction::triggered, m_manager, &MonitorManager::activateAudioSpectrum);
    addAction(a);
    setContextMenuPolicy(Qt::ActionsContextMenu);
}