Example #1
0
/*!
    \internal
*/
QLayout *QFormBuilder::createLayout(const QString &layoutName, QObject *parent, const QString &name)
{
    QLayout *l = 0;

    QWidget *parentWidget = qobject_cast<QWidget*>(parent);
    QLayout *parentLayout = qobject_cast<QLayout*>(parent);

    Q_ASSERT(parentWidget || parentLayout);

#define DECLARE_WIDGET(W, C)
#define DECLARE_COMPAT_WIDGET(W, C)

#define DECLARE_LAYOUT(L, C) \
    if (layoutName == QLatin1String(#L)) { \
        Q_ASSERT(l == 0); \
        l = parentLayout \
            ? new L() \
            : new L(parentWidget); \
    }

#include "widgets.table"

#undef DECLARE_LAYOUT
#undef DECLARE_COMPAT_WIDGET
#undef DECLARE_WIDGET

    if (l) {
        l->setObjectName(name);
    } else {
        qWarning() << QCoreApplication::translate("QFormBuilder", "The layout type `%1' is not supported.").arg(layoutName);
    }

    return l;
}
Example #2
0
/*!
    \internal
*/
QLayout *QFormBuilder::createLayout(const QString &layoutName, QObject *parent, const QString &name)
{
    QLayout *l = 0;

    QWidget *parentWidget = qobject_cast<QWidget*>(parent);
    QLayout *parentLayout = qobject_cast<QLayout*>(parent);

    Q_ASSERT(parentWidget || parentLayout);

#define DECLARE_WIDGET(W, C)
#define DECLARE_COMPAT_WIDGET(W, C)

#define DECLARE_LAYOUT(L, C) \
    if (layoutName == QLatin1String(#L)) { \
        Q_ASSERT(l == 0); \
        l = parentLayout \
            ? new L() \
            : new L(parentWidget); \
    }

#include "widgets.table"

#undef DECLARE_LAYOUT
#undef DECLARE_COMPAT_WIDGET
#undef DECLARE_WIDGET

    if (l) {
        l->setObjectName(name);
        if (parentLayout) {
            QWidget *w = qobject_cast<QWidget *>(parentLayout->parent());
            if (w && w->inherits("Q3GroupBox")) {
                l->setContentsMargins(w->style()->pixelMetric(QStyle::PM_LayoutLeftMargin),
                                    w->style()->pixelMetric(QStyle::PM_LayoutTopMargin),
                                    w->style()->pixelMetric(QStyle::PM_LayoutRightMargin),
                                    w->style()->pixelMetric(QStyle::PM_LayoutBottomMargin));
                QGridLayout *grid = qobject_cast<QGridLayout *>(l);
                if (grid) {
                    grid->setHorizontalSpacing(-1);
                    grid->setVerticalSpacing(-1);
                } else {
                    l->setSpacing(-1);
                }
                l->setAlignment(Qt::AlignTop);
            }
        }
    } else {
        qWarning() << QCoreApplication::translate("QFormBuilder", "The layout type `%1' is not supported.").arg(layoutName);
    }

    return l;
}
Example #3
0
MainWindow::MainWindow()
    : QMainWindow(0)
    , ui(new Ui::MainWindow)
    , m_isKKeyPressed(false)
{
    // Create the UI.
    ui->setupUi(this);
#ifndef Q_WS_X11
    ui->mainToolBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
#endif
    setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea);
    setCorner(Qt::TopRightCorner, Qt::RightDockWidgetArea);
    setDockNestingEnabled(true);

    // These use the icon theme on Linux, with fallbacks to the icons specified in QtDesigner for other platforms.
    ui->actionOpen->setIcon(QIcon::fromTheme("document-open", ui->actionOpen->icon()));
    ui->actionSave->setIcon(QIcon::fromTheme("document-save", ui->actionSave->icon()));
    ui->actionEncode->setIcon(QIcon::fromTheme("media-record", ui->actionEncode->icon()));

    // Connect UI signals.
    connect(ui->actionOpen, SIGNAL(triggered()), this, SLOT(openVideo()));
    connect(ui->actionAbout_Qt, SIGNAL(triggered()), qApp, SLOT(aboutQt()));

    // Accept drag-n-drop of files.
    this->setAcceptDrops(true);

    // Add the player widget.
    QLayout* layout = new QVBoxLayout(ui->playerPage);
    layout->setObjectName("centralWidgetLayout");
    layout->setMargin(0);
    m_player = new Player(this);
    layout->addWidget(m_player);
    connect(this, SIGNAL(producerOpened()), m_player, SLOT(onProducerOpened()));
    connect(m_player, SIGNAL(showStatusMessage(QString)), this, SLOT(showStatusMessage(QString)));
    connect(m_player, SIGNAL(inChanged(int)), this, SLOT(onCutModified()));
    connect(m_player, SIGNAL(outChanged(int)), this, SLOT(onCutModified()));

    // Add the docks.
    m_propertiesDock = new QDockWidget(tr("Properties"));
    m_propertiesDock->hide();
    m_propertiesDock->setObjectName("propertiesDock");
    m_propertiesDock->setWindowIcon(QIcon((":/icons/icons/view-form.png")));
    m_propertiesDock->toggleViewAction()->setIcon(QIcon::fromTheme("view-form", m_propertiesDock->windowIcon()));
    addDockWidget(Qt::LeftDockWidgetArea, m_propertiesDock);
    ui->menuView->addAction(m_propertiesDock->toggleViewAction());
    ui->mainToolBar->addAction(m_propertiesDock->toggleViewAction());
    connect(m_propertiesDock->toggleViewAction(), SIGNAL(triggered(bool)), this, SLOT(onPropertiesDockTriggered(bool)));

    m_recentDock = new RecentDock(this);
    m_recentDock->hide();
    addDockWidget(Qt::LeftDockWidgetArea, m_recentDock);
    ui->menuView->addAction(m_recentDock->toggleViewAction());
    ui->mainToolBar->addAction(m_recentDock->toggleViewAction());
    connect(m_recentDock, SIGNAL(itemActivated(QString)), this, SLOT(open(QString)));
    connect(m_recentDock->toggleViewAction(), SIGNAL(triggered(bool)), this, SLOT(onRecentDockTriggered(bool)));

    m_playlistDock = new PlaylistDock(this);
    m_playlistDock->hide();
    addDockWidget(Qt::LeftDockWidgetArea, m_playlistDock);
    ui->menuView->addAction(m_playlistDock->toggleViewAction());
    ui->mainToolBar->addAction(m_playlistDock->toggleViewAction());
    connect(m_playlistDock->toggleViewAction(), SIGNAL(triggered(bool)), this, SLOT(onPlaylistDockTriggered(bool)));
    connect(m_playlistDock, SIGNAL(clipOpened(void*,int,int)), this, SLOT(openCut(void*, int, int)));
    connect(m_playlistDock, SIGNAL(itemActivated(int)), this, SLOT(seekPlaylist(int)));
    connect(m_playlistDock, SIGNAL(showStatusMessage(QString)), this, SLOT(showStatusMessage(QString)));
    connect(m_playlistDock->model(), SIGNAL(created()), this, SLOT(onPlaylistCreated()));
    connect(m_playlistDock->model(), SIGNAL(cleared()), this, SLOT(onPlaylistCleared()));
    connect(m_playlistDock->model(), SIGNAL(closed()), this, SLOT(onPlaylistClosed()));
    connect(m_playlistDock->model(), SIGNAL(modified()), this, SLOT(onPlaylistModified()));
    connect(m_playlistDock->model(), SIGNAL(loaded()), this, SLOT(updateMarkers()));
    connect(m_playlistDock->model(), SIGNAL(modified()), this, SLOT(updateMarkers()));

    tabifyDockWidget(m_recentDock, m_propertiesDock);
    tabifyDockWidget(m_propertiesDock, m_playlistDock);
    m_recentDock->raise();

    m_encodeDock = new EncodeDock(this);
    m_encodeDock->hide();
    addDockWidget(Qt::RightDockWidgetArea, m_encodeDock);
    ui->menuView->addAction(m_encodeDock->toggleViewAction());
    ui->mainToolBar->addAction(ui->actionEncode);
    connect(this, SIGNAL(producerOpened()), m_encodeDock, SLOT(onProducerOpened()));
    connect(m_encodeDock, SIGNAL(visibilityChanged(bool)), ui->actionEncode, SLOT(setChecked(bool)));
    connect(m_encodeDock, SIGNAL(captureStateChanged(bool)), m_player, SLOT(onCaptureStateChanged(bool)));
    connect(m_encodeDock, SIGNAL(captureStateChanged(bool)), m_propertiesDock, SLOT(setDisabled(bool)));
    connect(m_encodeDock, SIGNAL(captureStateChanged(bool)), m_recentDock, SLOT(setDisabled(bool)));
    connect(m_encodeDock, SIGNAL(captureStateChanged(bool)), ui->actionOpen, SLOT(setDisabled(bool)));
    connect(m_encodeDock, SIGNAL(captureStateChanged(bool)), ui->actionOpenOther, SLOT(setDisabled(bool)));
    connect(m_encodeDock, SIGNAL(captureStateChanged(bool)), ui->actionExit, SLOT(setDisabled(bool)));
    connect(m_encodeDock, SIGNAL(captureStateChanged(bool)), this, SLOT(onCaptureStateChanged(bool)));

    m_jobsDock = new JobsDock(this);
    m_jobsDock->hide();
    addDockWidget(Qt::RightDockWidgetArea, m_jobsDock);
    tabifyDockWidget(m_encodeDock, m_jobsDock);
    ui->menuView->addAction(m_jobsDock->toggleViewAction());
    connect(&JOBS, SIGNAL(jobAdded()), m_jobsDock, SLOT(show()));
    connect(&JOBS, SIGNAL(jobAdded()), m_jobsDock, SLOT(raise()));
    connect(m_jobsDock, SIGNAL(visibilityChanged(bool)), this, SLOT(onJobsVisibilityChanged(bool)));

    // Connect signals.
    connect(this, SIGNAL(producerOpened()), this, SLOT(onProducerOpened()));

    // connect video widget signals
#if defined(Q_WS_MAC) || defined(Q_WS_WIN)
    Mlt::GLWidget* videoWidget = (Mlt::GLWidget*) &(MLT);
    connect(videoWidget, SIGNAL(dragStarted()), m_playlistDock, SLOT(onPlayerDragStarted()));
    connect(videoWidget, SIGNAL(seekTo(int)), m_player, SLOT(seek(int)));
#else
    if (m_settings.value("player/opengl", true).toBool()) {
        Mlt::GLWidget* videoWidget = (Mlt::GLWidget*) &(MLT);
        connect(videoWidget, SIGNAL(dragStarted()), m_playlistDock, SLOT(onPlayerDragStarted()));
        connect(videoWidget, SIGNAL(seekTo(int)), m_player, SLOT(seek(int)));
    }
    else {
        Mlt::SDLWidget* videoWidget = (Mlt::SDLWidget*) &(MLT);
        connect(videoWidget, SIGNAL(dragStarted()), m_playlistDock, SLOT(onPlayerDragStarted()));
        connect(videoWidget, SIGNAL(seekTo(int)), m_player, SLOT(seek(int)));
    }
#endif

    readSettings();
    setFocus();
    setCurrentFile("");
}
Example #4
0
/**
 * Constructs a new PropertyDialog.
 */
PropertyDialog::PropertyDialog(NeuralNetworkEditor *owner)
	: EditorToolWidget(owner), mInitialized(false), mCurrentProperties(0), 
	  mPropertyList(0), mListScrollArea(0),
	  mSetButton(0), mChangeButton(0), mRemoveButton(0), mPropertySelectionField(0),
	  mValueEditField(0)
{
	setObjectName("PropertyDialog");

	QVBoxLayout *layout = new QVBoxLayout(this);	
	layout->setObjectName("MainLayout");
	setLayout(layout);

	QLayout *nameLayout = new QHBoxLayout();
	layout->addLayout(nameLayout);

	QLayout *listLayout = new QHBoxLayout();
	listLayout->setObjectName("ListLayout");
	layout->addLayout(listLayout);

	QHBoxLayout *propertySelectLayout = new QHBoxLayout();	
	layout->addLayout(propertySelectLayout);

	QHBoxLayout *valueEditLayout = new QHBoxLayout();
	layout->addLayout(valueEditLayout);

	QHBoxLayout *buttonLayout = new QHBoxLayout();
	buttonLayout->setObjectName("ButtonLayout");
	layout->addLayout(buttonLayout);

	QHBoxLayout *autoSelectLayout = new QHBoxLayout();
	autoSelectLayout->setObjectName("AutoSelectLayout");
	layout->addLayout(autoSelectLayout);

	QHBoxLayout *typeSelectionLayout = new QHBoxLayout();
	layout->addLayout(typeSelectionLayout);
	QHBoxLayout *typeSelectionLayoutLower = new QHBoxLayout();
	layout->addLayout(typeSelectionLayoutLower);


	mNameLabel = new QLabel("");
	nameLayout->addWidget(mNameLabel);

	mPropertyList = new QListWidget(this);
	mListScrollArea = new QScrollArea(this);
	mListScrollArea->setWidget(mPropertyList);
	mListScrollArea->setWidgetResizable(true);
	listLayout->addWidget(mListScrollArea);

	mPropertySelectionField = new QComboBox(this);
	mPropertySelectionField->setEditable(true);
	addStandardPropertyTemplates();
	propertySelectLayout->addWidget(mPropertySelectionField);
	
	mValueEditField = new QLineEdit();
	valueEditLayout->addWidget(mValueEditField);

	mSetButton = new QPushButton("Set", this);
	mSetButton->setContentsMargins(2, 2, 2, 2);
	mSetButton->setMinimumWidth(15);
	mChangeButton = new QPushButton("Change", this);
	mChangeButton->setContentsMargins(2, 2, 2, 2);
	mChangeButton->setMinimumWidth(15);
	mRemoveButton = new QPushButton("Delete", this);
	mRemoveButton->setContentsMargins(2, 2, 2, 2);
	mRemoveButton->setMinimumWidth(15);
	mApplyToAllIndividuals = new QCheckBox("All", this);
	mApplyToAllIndividuals->setChecked(false);
	mApplyToAllIndividuals->setToolTip("Apply changes to all individuals (Evolution only)");
	mShowAllProperties = new QCheckBox("H", this);
	mShowAllProperties->setChecked(false),
	mShowAllProperties->setToolTip("Show also hidden properties");

	buttonLayout->addWidget(mSetButton);
	buttonLayout->addWidget(mChangeButton);
	buttonLayout->addWidget(mRemoveButton);
	buttonLayout->addWidget(mApplyToAllIndividuals);
	buttonLayout->addWidget(mShowAllProperties);

	mSelectMatchingElementsButton = new QPushButton("Select Matching");
	mForceExactMatchForSelectionCheckBox = new QCheckBox("Exact");
	mForceExactMatchForSelectionCheckBox->setChecked(false);
	mShowNonMatchingElementsCheckBox = new QCheckBox("Negate");
	mShowNonMatchingElementsCheckBox->setChecked(false);

	autoSelectLayout->addWidget(mSelectMatchingElementsButton);
	autoSelectLayout->addWidget(mForceExactMatchForSelectionCheckBox);
	autoSelectLayout->addWidget(mShowNonMatchingElementsCheckBox);

	mConsiderNeurons = new QCheckBox("N");
	mConsiderSynapses = new QCheckBox("S");
	mConsiderGroups = new QCheckBox("G");
	mConsiderModules = new QCheckBox("M");

	mHelpButton = new QPushButton("Help");
	mHelpButton->setContentsMargins(2, 2, 2, 2);
	mHelpButton->setMinimumWidth(15);

	mConsiderNeurons->setMinimumWidth(10);
	mConsiderSynapses->setMinimumWidth(10);
	mConsiderGroups->setMinimumWidth(10);
	mConsiderModules->setMinimumWidth(10);

	typeSelectionLayout->addWidget(mConsiderNeurons);
	typeSelectionLayout->addWidget(mConsiderSynapses);
	typeSelectionLayout->addWidget(mConsiderGroups);
	typeSelectionLayout->addWidget(mConsiderModules);
	typeSelectionLayout->addWidget(mHelpButton);
	


	if(mEditor != 0) {
		connect(mEditor, SIGNAL(tabSelectionChanged(int)),
				this, SLOT(currentEditorTabChanged(int)));
	}