Exemplo n.º 1
0
GNumericalExpressionSettingsWidget::GNumericalExpressionSettingsWidget( GNumericalExpression* numericalExpression, QObject* parent /*= NULL*/)	
{
	m_NumericalExpression = numericalExpression;

	QGroupBox* pExpressionSettings = new QGroupBox;
	QBoxLayout* pExpressionSettingsLayout = new QVBoxLayout;
	QBoxLayout* pExpressionEditLayout = new QHBoxLayout;
	pExpressionSettings->setFixedWidth(400);
	pExpressionSettings->setTitle("Expression Settings");
	pExpressionSettings->setLayout(pExpressionSettingsLayout);
	pExpressionEditLayout->insertWidget(0, new QLabel("Expression:"), 0);
	pExpressionEditLayout->insertWidget(1, m_NumericalExpression->m_Expression.ProvideNewParamLineEdit(pExpressionSettings), 0);
	pExpressionSettingsLayout->insertLayout(0, pExpressionEditLayout);

	QGroupBox* pVariableSettings = new QGroupBox;
	QGroupBox* pShowVariables = new QGroupBox;
	QBoxLayout* pShowVariablesLayout = new QVBoxLayout;
	QBoxLayout* pVariableSettingsLayout = new QVBoxLayout;
	QRadioButton* pLayoutVariablesVertically = new QRadioButton;
	QRadioButton* pLayoutVariablesHorizontally = new QRadioButton;
	QRadioButton* pLayoutVariablesGrid = new QRadioButton;
	pVariableSettings->setFixedWidth(400);
	pVariableSettings->setTitle("Variable Settings");
	pVariableSettings->setLayout(pVariableSettingsLayout);
	pShowVariables->setTitle("Show Variables");
	pShowVariables->setCheckable(true);
	pShowVariables->setLayout(pShowVariablesLayout);
	pLayoutVariablesHorizontally->setText("Layout: Horizontal");
	pShowVariablesLayout->insertWidget(0, pLayoutVariablesHorizontally);
	pLayoutVariablesVertically->setText("Layout: Vertical");
	pShowVariablesLayout->insertWidget(1, pLayoutVariablesVertically);
	pLayoutVariablesGrid->setText("Layout: Grid");
	pShowVariablesLayout->insertWidget(2, pLayoutVariablesGrid);
	pVariableSettingsLayout->insertWidget(0, pShowVariables);
	
	QPushButton* pAcceptButton = new QPushButton;
	QPushButton* pCloseButton = new QPushButton;
	QBoxLayout* pButtonLayout = new QHBoxLayout;
	pAcceptButton->setText("Accept");
	connect(pAcceptButton, SIGNAL(clicked(bool)), this, SLOT(Accept()));
	pCloseButton->setText("Close");
	connect(pCloseButton, SIGNAL(clicked(bool)), this, SLOT(close()));
	pButtonLayout->insertWidget(0, pAcceptButton, 1);
	pButtonLayout->insertWidget(1, pCloseButton, 1);

	QBoxLayout* pMainLayout = new QVBoxLayout;
	pMainLayout->setSizeConstraint(QLayout::SetFixedSize);
	setLayout(pMainLayout);
	pMainLayout->insertWidget(0, pExpressionSettings, 1);
	pMainLayout->insertWidget(1, pVariableSettings, 1);
	pMainLayout->insertLayout(2, pButtonLayout, 0);
}
void PathStrokeControls::layoutForDesktop()
{
    QGroupBox *mainGroup = new QGroupBox(this);
    mainGroup->setFixedWidth(180);
    mainGroup->setTitle(tr("Path Stroking"));

    createCommonControls(mainGroup);

    QGroupBox* penWidthGroup = new QGroupBox(mainGroup);
    QSlider *penWidth = new QSlider(Qt::Horizontal, penWidthGroup);
    penWidth->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
    penWidthGroup->setTitle(tr("Pen Width"));
    penWidth->setRange(0, 500);

    QPushButton *animated = new QPushButton(mainGroup);
    animated->setText(tr("Animate"));
    animated->setCheckable(true);

    QPushButton *showSourceButton = new QPushButton(mainGroup);
    showSourceButton->setText(tr("Show Source"));
#ifdef QT_OPENGL_SUPPORT
    QPushButton *enableOpenGLButton = new QPushButton(mainGroup);
    enableOpenGLButton->setText(tr("Use OpenGL"));
    enableOpenGLButton->setCheckable(true);
    enableOpenGLButton->setChecked(m_renderer->usesOpenGL());
    if (!QGLFormat::hasOpenGL())
        enableOpenGLButton->hide();
#endif
    QPushButton *whatsThisButton = new QPushButton(mainGroup);
    whatsThisButton->setText(tr("What's This?"));
    whatsThisButton->setCheckable(true);


    // Layouts:
    QVBoxLayout *penWidthLayout = new QVBoxLayout(penWidthGroup);
    penWidthLayout->addWidget(penWidth);

    QVBoxLayout * mainLayout = new QVBoxLayout(this);
    mainLayout->setMargin(0);
    mainLayout->addWidget(mainGroup);

    QVBoxLayout *mainGroupLayout = new QVBoxLayout(mainGroup);
    mainGroupLayout->setMargin(3);
    mainGroupLayout->addWidget(m_capGroup);
    mainGroupLayout->addWidget(m_joinGroup);
    mainGroupLayout->addWidget(m_styleGroup);
    mainGroupLayout->addWidget(penWidthGroup);
    mainGroupLayout->addWidget(m_pathModeGroup);
    mainGroupLayout->addWidget(animated);
    mainGroupLayout->addStretch(1);
    mainGroupLayout->addWidget(showSourceButton);
#ifdef QT_OPENGL_SUPPORT
    mainGroupLayout->addWidget(enableOpenGLButton);
#endif
    mainGroupLayout->addWidget(whatsThisButton);


    // Set up connections
    connect(animated, SIGNAL(toggled(bool)), m_renderer, SLOT(setAnimation(bool)));

    connect(penWidth, SIGNAL(valueChanged(int)), m_renderer, SLOT(setPenWidth(int)));

    connect(showSourceButton, SIGNAL(clicked()), m_renderer, SLOT(showSource()));
#ifdef QT_OPENGL_SUPPORT
    connect(enableOpenGLButton, SIGNAL(clicked(bool)), m_renderer, SLOT(enableOpenGL(bool)));
#endif
    connect(whatsThisButton, SIGNAL(clicked(bool)), m_renderer, SLOT(setDescriptionEnabled(bool)));
    connect(m_renderer, SIGNAL(descriptionEnabledChanged(bool)),
            whatsThisButton, SLOT(setChecked(bool)));


    // Set the defaults
    animated->setChecked(true);
    penWidth->setValue(50);

}
Exemplo n.º 3
0
GradientWidget::GradientWidget(QWidget *parent)
    : QWidget(parent)
{
    setWindowTitle(tr("Gradients"));

    m_renderer = new GradientRenderer(this);

    QGroupBox *mainGroup = new QGroupBox(this);
    mainGroup->setTitle(tr("Gradients"));

    QGroupBox *editorGroup = new QGroupBox(mainGroup);
    editorGroup->setTitle(tr("Color Editor"));
    m_editor = new GradientEditor(editorGroup);

    QGroupBox *typeGroup = new QGroupBox(mainGroup);
    typeGroup->setTitle(tr("Gradient Type"));
    m_linearButton = new QRadioButton(tr("Linear Gradient"), typeGroup);
    m_radialButton = new QRadioButton(tr("Radial Gradient"), typeGroup);
    m_conicalButton = new QRadioButton(tr("Conical Gradient"), typeGroup);

    QGroupBox *spreadGroup = new QGroupBox(mainGroup);
    spreadGroup->setTitle(tr("Spread Method"));
    m_padSpreadButton = new QRadioButton(tr("Pad Spread"), spreadGroup);
    m_reflectSpreadButton = new QRadioButton(tr("Reflect Spread"), spreadGroup);
    m_repeatSpreadButton = new QRadioButton(tr("Repeat Spread"), spreadGroup);

    QGroupBox *defaultsGroup = new QGroupBox(mainGroup);
    defaultsGroup->setTitle(tr("Defaults"));
    QPushButton *default1Button = new QPushButton(tr("1"), defaultsGroup);
    QPushButton *default2Button = new QPushButton(tr("2"), defaultsGroup);
    QPushButton *default3Button = new QPushButton(tr("3"), defaultsGroup);
    QPushButton *default4Button = new QPushButton(tr("Reset"), editorGroup);

    QPushButton *showSourceButton = new QPushButton(mainGroup);
    showSourceButton->setText(tr("Show Source"));
#ifdef QT_OPENGL_SUPPORT
    QPushButton *enableOpenGLButton = new QPushButton(mainGroup);
    enableOpenGLButton->setText(tr("Use OpenGL"));
    enableOpenGLButton->setCheckable(true);
    enableOpenGLButton->setChecked(m_renderer->usesOpenGL());
    if (!QGLFormat::hasOpenGL())
        enableOpenGLButton->hide();
#endif
    QPushButton *whatsThisButton = new QPushButton(mainGroup);
    whatsThisButton->setText(tr("What's This?"));
    whatsThisButton->setCheckable(true);

    // Layouts
    QHBoxLayout *mainLayout = new QHBoxLayout(this);
    mainLayout->addWidget(m_renderer);
    mainLayout->addWidget(mainGroup);

    mainGroup->setFixedWidth(180);
    QVBoxLayout *mainGroupLayout = new QVBoxLayout(mainGroup);
    mainGroupLayout->addWidget(editorGroup);
    mainGroupLayout->addWidget(typeGroup);
    mainGroupLayout->addWidget(spreadGroup);
    mainGroupLayout->addWidget(defaultsGroup);
    mainGroupLayout->addStretch(1);
    mainGroupLayout->addWidget(showSourceButton);
#ifdef QT_OPENGL_SUPPORT
    mainGroupLayout->addWidget(enableOpenGLButton);
#endif
    mainGroupLayout->addWidget(whatsThisButton);

    QVBoxLayout *editorGroupLayout = new QVBoxLayout(editorGroup);
    editorGroupLayout->addWidget(m_editor);

    QVBoxLayout *typeGroupLayout = new QVBoxLayout(typeGroup);
    typeGroupLayout->addWidget(m_linearButton);
    typeGroupLayout->addWidget(m_radialButton);
    typeGroupLayout->addWidget(m_conicalButton);

    QVBoxLayout *spreadGroupLayout = new QVBoxLayout(spreadGroup);
    spreadGroupLayout->addWidget(m_padSpreadButton);
    spreadGroupLayout->addWidget(m_repeatSpreadButton);
    spreadGroupLayout->addWidget(m_reflectSpreadButton);

    QHBoxLayout *defaultsGroupLayout = new QHBoxLayout(defaultsGroup);
    defaultsGroupLayout->addWidget(default1Button);
    defaultsGroupLayout->addWidget(default2Button);
    defaultsGroupLayout->addWidget(default3Button);
    editorGroupLayout->addWidget(default4Button);

    connect(m_editor, SIGNAL(gradientStopsChanged(QGradientStops)),
            m_renderer, SLOT(setGradientStops(QGradientStops)));

    connect(m_linearButton, SIGNAL(clicked()), m_renderer, SLOT(setLinearGradient()));
    connect(m_radialButton, SIGNAL(clicked()), m_renderer, SLOT(setRadialGradient()));
    connect(m_conicalButton, SIGNAL(clicked()), m_renderer, SLOT(setConicalGradient()));

    connect(m_padSpreadButton, SIGNAL(clicked()), m_renderer, SLOT(setPadSpread()));
    connect(m_reflectSpreadButton, SIGNAL(clicked()), m_renderer, SLOT(setReflectSpread()));
    connect(m_repeatSpreadButton, SIGNAL(clicked()), m_renderer, SLOT(setRepeatSpread()));

    connect(default1Button, SIGNAL(clicked()), this, SLOT(setDefault1()));
    connect(default2Button, SIGNAL(clicked()), this, SLOT(setDefault2()));
    connect(default3Button, SIGNAL(clicked()), this, SLOT(setDefault3()));
    connect(default4Button, SIGNAL(clicked()), this, SLOT(setDefault4()));

    connect(showSourceButton, SIGNAL(clicked()), m_renderer, SLOT(showSource()));
#ifdef QT_OPENGL_SUPPORT
    connect(enableOpenGLButton, SIGNAL(clicked(bool)), m_renderer, SLOT(enableOpenGL(bool)));
#endif    
    connect(whatsThisButton, SIGNAL(clicked(bool)), m_renderer, SLOT(setDescriptionEnabled(bool)));
    connect(whatsThisButton, SIGNAL(clicked(bool)),
            m_renderer->hoverPoints(), SLOT(setDisabled(bool)));
    connect(m_renderer, SIGNAL(descriptionEnabledChanged(bool)),
            whatsThisButton, SLOT(setChecked(bool)));
    connect(m_renderer, SIGNAL(descriptionEnabledChanged(bool)),
            m_renderer->hoverPoints(), SLOT(setDisabled(bool)));

    m_renderer->loadSourceFile(":res/gradients/gradients.cpp");
    m_renderer->loadDescription(":res/gradients/gradients.html");

    QTimer::singleShot(50, this, SLOT(setDefault1()));
}
XFormWidget::XFormWidget(QWidget *parent)
    : QWidget(parent), textEditor(new QLineEdit)
{
    setWindowTitle(tr("Affine Transformations"));

    view = new XFormView(this);
    view->setMinimumSize(200, 200);

    QGroupBox *mainGroup = new QGroupBox(this);
    mainGroup->setFixedWidth(180);
    mainGroup->setTitle(tr("Affine Transformations"));

    QGroupBox *rotateGroup = new QGroupBox(mainGroup);
    rotateGroup->setTitle(tr("Rotate"));
    QSlider *rotateSlider = new QSlider(Qt::Horizontal, rotateGroup);
    rotateSlider->setRange(0, 3600);
    rotateSlider->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);

    QGroupBox *scaleGroup = new QGroupBox(mainGroup);
    scaleGroup->setTitle(tr("Scale"));
    QSlider *scaleSlider = new QSlider(Qt::Horizontal, scaleGroup);
    scaleSlider->setRange(1, 4000);
    scaleSlider->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);

    QGroupBox *shearGroup = new QGroupBox(mainGroup);
    shearGroup->setTitle(tr("Shear"));
    QSlider *shearSlider = new QSlider(Qt::Horizontal, shearGroup);
    shearSlider->setRange(-990, 990);
    shearSlider->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);

    QGroupBox *typeGroup = new QGroupBox(mainGroup);
    typeGroup->setTitle(tr("Type"));
    QRadioButton *vectorType = new QRadioButton(typeGroup);
    QRadioButton *pixmapType = new QRadioButton(typeGroup);
    QRadioButton *textType= new QRadioButton(typeGroup);
    vectorType->setText(tr("Vector Image"));
    pixmapType->setText(tr("Pixmap"));
    textType->setText(tr("Text"));

    QPushButton *resetButton = new QPushButton(mainGroup);
    resetButton->setText(tr("Reset Transform"));

    QPushButton *animateButton = new QPushButton(mainGroup);
    animateButton->setText(tr("Animate"));
    animateButton->setCheckable(true);

    QPushButton *showSourceButton = new QPushButton(mainGroup);
    showSourceButton->setText(tr("Show Source"));
#ifdef QT_OPENGL_SUPPORT
    QPushButton *enableOpenGLButton = new QPushButton(mainGroup);
    enableOpenGLButton->setText(tr("Use OpenGL"));
    enableOpenGLButton->setCheckable(true);
    enableOpenGLButton->setChecked(view->usesOpenGL());
    if (!QGLFormat::hasOpenGL())
        enableOpenGLButton->hide();
#endif
    QPushButton *whatsThisButton = new QPushButton(mainGroup);
    whatsThisButton->setText(tr("What's This?"));
    whatsThisButton->setCheckable(true);

    QHBoxLayout *viewLayout = new QHBoxLayout(this);
    viewLayout->addWidget(view);
    viewLayout->addWidget(mainGroup);

    QVBoxLayout *rotateGroupLayout = new QVBoxLayout(rotateGroup);
    rotateGroupLayout->addWidget(rotateSlider);

    QVBoxLayout *scaleGroupLayout = new QVBoxLayout(scaleGroup);
    scaleGroupLayout->addWidget(scaleSlider);

    QVBoxLayout *shearGroupLayout = new QVBoxLayout(shearGroup);
    shearGroupLayout->addWidget(shearSlider);

    QVBoxLayout *typeGroupLayout = new QVBoxLayout(typeGroup);
    typeGroupLayout->addWidget(vectorType);
    typeGroupLayout->addWidget(pixmapType);
    typeGroupLayout->addWidget(textType);
    typeGroupLayout->addSpacing(4);
    typeGroupLayout->addWidget(textEditor);

    QVBoxLayout *mainGroupLayout = new QVBoxLayout(mainGroup);
    mainGroupLayout->addWidget(rotateGroup);
    mainGroupLayout->addWidget(scaleGroup);
    mainGroupLayout->addWidget(shearGroup);
    mainGroupLayout->addWidget(typeGroup);
    mainGroupLayout->addStretch(1);
    mainGroupLayout->addWidget(resetButton);
    mainGroupLayout->addWidget(animateButton);
    mainGroupLayout->addWidget(showSourceButton);
#ifdef QT_OPENGL_SUPPORT
    mainGroupLayout->addWidget(enableOpenGLButton);
#endif
    mainGroupLayout->addWidget(whatsThisButton);

    connect(rotateSlider, SIGNAL(valueChanged(int)), view, SLOT(changeRotation(int)));
    connect(shearSlider, SIGNAL(valueChanged(int)), view, SLOT(changeShear(int)));
    connect(scaleSlider, SIGNAL(valueChanged(int)), view, SLOT(changeScale(int)));

    connect(vectorType, SIGNAL(clicked()), view, SLOT(setVectorType()));
    connect(pixmapType, SIGNAL(clicked()), view, SLOT(setPixmapType()));
    connect(textType, SIGNAL(clicked()), view, SLOT(setTextType()));
    connect(textType, SIGNAL(toggled(bool)), textEditor, SLOT(setEnabled(bool)));
    connect(textEditor, SIGNAL(textChanged(QString)), view, SLOT(setText(QString)));

    connect(view, SIGNAL(rotationChanged(int)), rotateSlider, SLOT(setValue(int)));
    connect(view, SIGNAL(scaleChanged(int)), scaleSlider, SLOT(setValue(int)));
    connect(view, SIGNAL(shearChanged(int)), shearSlider, SLOT(setValue(int)));

    connect(resetButton, SIGNAL(clicked()), view, SLOT(reset()));
    connect(animateButton, SIGNAL(clicked(bool)), view, SLOT(setAnimation(bool)));
    connect(whatsThisButton, SIGNAL(clicked(bool)), view, SLOT(setDescriptionEnabled(bool)));
    connect(whatsThisButton, SIGNAL(clicked(bool)), view->hoverPoints(), SLOT(setDisabled(bool)));
    connect(view, SIGNAL(descriptionEnabledChanged(bool)), view->hoverPoints(), SLOT(setDisabled(bool)));
    connect(view, SIGNAL(descriptionEnabledChanged(bool)), whatsThisButton, SLOT(setChecked(bool)));
    connect(showSourceButton, SIGNAL(clicked()), view, SLOT(showSource()));
#ifdef QT_OPENGL_SUPPORT
    connect(enableOpenGLButton, SIGNAL(clicked(bool)), view, SLOT(enableOpenGL(bool)));
#endif
    view->loadSourceFile(":res/affine/xform.cpp");
    view->loadDescription(":res/affine/xform.html");

    // defaults
    view->reset();
    vectorType->setChecked(true);
    textEditor->setText("Qt Affine Transformation Demo");
    textEditor->setEnabled(false);

    animateButton->animateClick();
}
Exemplo n.º 5
0
void PathDeformControls::layoutForDesktop()
{
    QGroupBox* mainGroup = new QGroupBox(this);
    mainGroup->setTitle(tr("Controls"));

    QGroupBox *radiusGroup = new QGroupBox(mainGroup);
    radiusGroup->setTitle(tr("Lens Radius"));
    QSlider *radiusSlider = new QSlider(Qt::Horizontal, radiusGroup);
    radiusSlider->setRange(15, 150);
    radiusSlider->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);

    QGroupBox *deformGroup = new QGroupBox(mainGroup);
    deformGroup->setTitle(tr("Deformation"));
    QSlider *deformSlider = new QSlider(Qt::Horizontal, deformGroup);
    deformSlider->setRange(-100, 100);
    deformSlider->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);

    QGroupBox *fontSizeGroup = new QGroupBox(mainGroup);
    fontSizeGroup->setTitle(tr("Font Size"));
    QSlider *fontSizeSlider = new QSlider(Qt::Horizontal, fontSizeGroup);
    fontSizeSlider->setRange(16, 200);
    fontSizeSlider->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);

    QGroupBox *textGroup = new QGroupBox(mainGroup);
    textGroup->setTitle(tr("Text"));
    QLineEdit *textInput = new QLineEdit(textGroup);

    QPushButton *animateButton = new QPushButton(mainGroup);
    animateButton->setText(tr("Animated"));
    animateButton->setCheckable(true);

    QPushButton *showSourceButton = new QPushButton(mainGroup);
    showSourceButton->setText(tr("Show Source"));

#ifdef QT_OPENGL_SUPPORT
    QPushButton *enableOpenGLButton = new QPushButton(mainGroup);
    enableOpenGLButton->setText(tr("Use OpenGL"));
    enableOpenGLButton->setCheckable(true);
    enableOpenGLButton->setChecked(m_renderer->usesOpenGL());
    if (!QGLFormat::hasOpenGL())
        enableOpenGLButton->hide();
#endif

    QPushButton *whatsThisButton = new QPushButton(mainGroup);
    whatsThisButton->setText(tr("What's This?"));
    whatsThisButton->setCheckable(true);


    mainGroup->setFixedWidth(180);

    QVBoxLayout *mainGroupLayout = new QVBoxLayout(mainGroup);
    mainGroupLayout->addWidget(radiusGroup);
    mainGroupLayout->addWidget(deformGroup);
    mainGroupLayout->addWidget(fontSizeGroup);
    mainGroupLayout->addWidget(textGroup);
    mainGroupLayout->addWidget(animateButton);
    mainGroupLayout->addStretch(1);
#ifdef QT_OPENGL_SUPPORT
    mainGroupLayout->addWidget(enableOpenGLButton);
#endif
    mainGroupLayout->addWidget(showSourceButton);
    mainGroupLayout->addWidget(whatsThisButton);

    QVBoxLayout *radiusGroupLayout = new QVBoxLayout(radiusGroup);
    radiusGroupLayout->addWidget(radiusSlider);

    QVBoxLayout *deformGroupLayout = new QVBoxLayout(deformGroup);
    deformGroupLayout->addWidget(deformSlider);

    QVBoxLayout *fontSizeGroupLayout = new QVBoxLayout(fontSizeGroup);
    fontSizeGroupLayout->addWidget(fontSizeSlider);

    QVBoxLayout *textGroupLayout = new QVBoxLayout(textGroup);
    textGroupLayout->addWidget(textInput);

    QVBoxLayout * mainLayout = new QVBoxLayout(this);
    mainLayout->addWidget(mainGroup);
    mainLayout->setMargin(0);

    connect(radiusSlider, SIGNAL(valueChanged(int)), m_renderer, SLOT(setRadius(int)));
    connect(deformSlider, SIGNAL(valueChanged(int)), m_renderer, SLOT(setIntensity(int)));
    connect(fontSizeSlider, SIGNAL(valueChanged(int)), m_renderer, SLOT(setFontSize(int)));
    connect(animateButton, SIGNAL(clicked(bool)), m_renderer, SLOT(setAnimated(bool)));
#ifdef QT_OPENGL_SUPPORT
    connect(enableOpenGLButton, SIGNAL(clicked(bool)), m_renderer, SLOT(enableOpenGL(bool)));
#endif

    connect(textInput, SIGNAL(textChanged(QString)), m_renderer, SLOT(setText(QString)));
    connect(m_renderer, SIGNAL(descriptionEnabledChanged(bool)),
            whatsThisButton, SLOT(setChecked(bool)));
    connect(whatsThisButton, SIGNAL(clicked(bool)), m_renderer, SLOT(setDescriptionEnabled(bool)));
    connect(showSourceButton, SIGNAL(clicked()), m_renderer, SLOT(showSource()));

    animateButton->animateClick();
    deformSlider->setValue(80);
    fontSizeSlider->setValue(120);
    radiusSlider->setValue(100);
    textInput->setText(tr("Qt"));
}
Exemplo n.º 6
0
MakeFilmWindow::MakeFilmWindow(QWidget* parent) :
    QDialog(parent) {

    // Normal
    _normalXEdit = new QLineEdit("0");
    _normalXEdit->setFixedWidth(50);
    QFormLayout* normalXLayout = new QFormLayout;
    normalXLayout->addRow("X:", _normalXEdit);
    _normalYEdit = new QLineEdit("1");
    _normalYEdit->setFixedWidth(50);
    QFormLayout* normalYLayout = new QFormLayout;
    normalYLayout->addRow("Y:", _normalYEdit);
    _normalZEdit = new QLineEdit("0");
    _normalZEdit->setFixedWidth(50);
    QFormLayout* normalZLayout = new QFormLayout;
    normalZLayout->addRow("Z:", _normalZEdit);
    QHBoxLayout* normalLayout = new QHBoxLayout;
    normalLayout->addLayout(normalXLayout);
    normalLayout->addLayout(normalYLayout);
    normalLayout->addLayout(normalZLayout);
    QGroupBox* normalGroupBox = new QGroupBox("Normal to plane", this);
    normalGroupBox->setFixedWidth(250);
    normalGroupBox->setLayout(normalLayout);

    // Center
    _circleCenterXEdit = new QLineEdit("0");
    _circleCenterXEdit->setFixedWidth(50);
    QFormLayout* centerXLayout = new QFormLayout;
    centerXLayout->addRow("X:", _circleCenterXEdit);
    _circleCenterYEdit = new QLineEdit("20");
    _circleCenterYEdit->setFixedWidth(50);
    QFormLayout* centerYLayout = new QFormLayout;
    centerYLayout->addRow("Y:", _circleCenterYEdit);
    _circleCenterZEdit = new QLineEdit("0");
    _circleCenterZEdit->setFixedWidth(50);
    QFormLayout* centerZLayout = new QFormLayout;
    centerZLayout->addRow("Z:", _circleCenterZEdit);
    QHBoxLayout* centerLayout = new QHBoxLayout;
    centerLayout->addLayout(centerXLayout);
    centerLayout->addLayout(centerYLayout);
    centerLayout->addLayout(centerZLayout);
    QGroupBox* centerGroupBox = new QGroupBox("Circle center", this);
    centerGroupBox->setFixedWidth(250);
    centerGroupBox->setLayout(centerLayout);

    // Aimed Point
    _aimedPointXEdit = new QLineEdit("0");
    _aimedPointXEdit->setFixedWidth(50);
    QFormLayout* aimedPointXLayout = new QFormLayout;
    aimedPointXLayout->addRow("X:", _aimedPointXEdit);
    _aimedPointYEdit = new QLineEdit("0");
    _aimedPointYEdit->setFixedWidth(50);
    QFormLayout* aimedPointYLayout = new QFormLayout;
    aimedPointYLayout->addRow("Y:", _aimedPointYEdit);
    _aimedPointZEdit = new QLineEdit("0");
    _aimedPointZEdit->setFixedWidth(50);
    QFormLayout* aimedPointZLayout = new QFormLayout;
    aimedPointZLayout->addRow("Z:", _aimedPointZEdit);
    QHBoxLayout* aimedPointLayout = new QHBoxLayout;
    aimedPointLayout->addLayout(aimedPointXLayout);
    aimedPointLayout->addLayout(aimedPointYLayout);
    aimedPointLayout->addLayout(aimedPointZLayout);
    QGroupBox* aimedPointGroupBox = new QGroupBox("Aimed point", this);
    aimedPointGroupBox->setFixedWidth(250);
    aimedPointGroupBox->setLayout(aimedPointLayout);

    // Nb Points
    _nbPointsEdit = new QLineEdit("50");
    _nbPointsEdit->setFixedWidth(50);
    QFormLayout* nbPointsLayout = new QFormLayout;
    nbPointsLayout->addRow("Value:", _nbPointsEdit);
    QGroupBox* nbPointsGroupBox = new QGroupBox("Number of screenshots", this);
    nbPointsGroupBox->setFixedWidth(250);
    nbPointsGroupBox->setLayout(nbPointsLayout);

    // Rayon
    _radiusEdit = new QLineEdit("40");
    _radiusEdit->setFixedWidth(50);
    QFormLayout* radiusLayout = new QFormLayout;
    radiusLayout->addRow("Value:", _radiusEdit);
    QGroupBox* radiusGroupBox = new QGroupBox("Circle radius", this);
    radiusGroupBox->setFixedWidth(250);
    radiusGroupBox->setLayout(radiusLayout);

    // File Name
    _filmNameEdit = new QLineEdit("Film");
    _filmNameEdit->setFixedWidth(200);
    QFormLayout* filmNameLayout = new QFormLayout;
    filmNameLayout->addRow("Value:", _filmNameEdit);
    QGroupBox* filmNameGroupBox = new QGroupBox("Film name", this);
    filmNameGroupBox->setFixedWidth(250);
    filmNameGroupBox->setLayout(filmNameLayout);

    // Buttons
    _okButton = new QPushButton("Ok");
    connect(_okButton, SIGNAL(clicked()), this, SLOT(checkFields()));
    _okButton->setDefault(true);
    _cancelButton = new QPushButton("Cancel");
    connect(_cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
    QHBoxLayout* buttonsLayout = new QHBoxLayout;
    buttonsLayout->addWidget(_okButton);
    buttonsLayout->addWidget(_cancelButton);

    // Main layout
    QVBoxLayout* mainLayout = new QVBoxLayout;
    mainLayout->addWidget(normalGroupBox);
    mainLayout->addWidget(centerGroupBox);
    mainLayout->addWidget(aimedPointGroupBox);
    mainLayout->addWidget(nbPointsGroupBox);
    mainLayout->addWidget(radiusGroupBox);
    mainLayout->addWidget(filmNameGroupBox);
    mainLayout->addLayout(buttonsLayout);

    setLayout(mainLayout);
}
Exemplo n.º 7
0
EditPanel::EditPanel(QWidget *parent)
	: QWidget(parent, Qt::Window)
{
	QGridLayout *layout = new QGridLayout(this);
	
	int row = 0;
	m_GridLabel = new QLabel(tr("Grid"), this);
	layout->addWidget(m_GridLabel, row, 0);
	m_Cols = new QSpinBox(this);
	m_Cols->setRange(1, 100);
	connect(m_Cols, SIGNAL(valueChanged(int)), this, SLOT(onGridChanged(int)));
	layout->addWidget(m_Cols, row, 1);
	m_Rows = new QSpinBox(this);
	m_Rows->setRange(1, 100);
	connect(m_Rows, SIGNAL(valueChanged(int)), this, SLOT(onGridChanged(int)));
	layout->addWidget(m_Rows, row, 2);
	
	++row;
	layout->addWidget(new QLabel(tr("Label"),this), row, 0);
	m_Text = new QLineEdit(this);
	connect(m_Text, SIGNAL(editingFinished()), this, SLOT(onEditingFinished()));
	layout->addWidget(m_Text, row, 1, 1, 2);
	
	++row;
	m_PathLabel = new QLabel(tr("OSC Output"), this);
	layout->addWidget(m_PathLabel, row, 0);
	m_Path = new QLineEdit(this);
	connect(m_Path, SIGNAL(editingFinished()), this, SLOT(onEditingFinished()));
	connect(m_Path, SIGNAL(textChanged(const QString&)), this, SLOT(onPathTextChanged(const QString&)));
	layout->addWidget(m_Path, row, 1, 1, 2);
	
	++row;
	m_Path2Label = new QLabel(tr("OSC Output 2"), this);
	layout->addWidget(m_Path2Label, row, 0);
	m_Path2 = new QLineEdit(this);
	connect(m_Path2, SIGNAL(editingFinished()), this, SLOT(onEditingFinished()));
	connect(m_Path2, SIGNAL(textChanged(const QString&)), this, SLOT(onPath2TextChanged(const QString&)));
	layout->addWidget(m_Path2, row, 1, 1, 2);
	
	++row;
	m_Local = new QCheckBox(tr("Local"), this);
	m_Local->setToolTip( tr("send commands to other OSCToy widgets") );
	connect(m_Local, SIGNAL(stateChanged(int)), this, SLOT(onLocalStateChanged(int)));
	layout->addWidget(m_Local, row, 1, 1, 2);
	
	++row;
	m_MinMaxLabel = new QLabel(tr("Min/Max"), this);
	layout->addWidget(m_MinMaxLabel, row, 0);
	m_Min = new QLineEdit(this);
	connect(m_Min, SIGNAL(editingFinished()), this, SLOT(onEditingFinished()));
	layout->addWidget(m_Min, row, 1);
	m_Max = new QLineEdit(this);
	connect(m_Max, SIGNAL(editingFinished()), this, SLOT(onEditingFinished()));
	layout->addWidget(m_Max, row, 2);

	++row;
	m_MinMax2Label = new QLabel(tr("Min/Max 2"), this);
	layout->addWidget(m_MinMax2Label, row, 0);
	m_Min2 = new QLineEdit(this);
	connect(m_Min2, SIGNAL(editingFinished()), this, SLOT(onEditingFinished()));
	layout->addWidget(m_Min2, row, 1);
	m_Max2 = new QLineEdit(this);
	connect(m_Max2, SIGNAL(editingFinished()), this, SLOT(onEditingFinished()));
	layout->addWidget(m_Max2, row, 2);

	++row;
	m_BPMLabel = new QLabel(tr("BPM"), this);
	layout->addWidget(m_BPMLabel, row, 0);
	m_BPM = new QLineEdit(this);
	m_BPM->setToolTip( tr("Beats per Minute") );
	SetToolTips(tr("Beats per Minute"), m_BPMLabel, m_BPM);
	connect(m_BPM, SIGNAL(editingFinished()), this, SLOT(onEditingFinished()));
	layout->addWidget(m_BPM, row, 1);

	++row;
	m_RecvPathLabel = new QLabel(tr("OSC Label"), this);
	layout->addWidget(m_RecvPathLabel, row, 0);
	m_RecvPath = new QLineEdit(this);
	SetToolTips(tr("Designate an incoming OSC command as a text label for this widget"), m_RecvPathLabel, m_RecvPath);
	connect(m_RecvPath, SIGNAL(editingFinished()), this, SLOT(onEditingFinished()));
	layout->addWidget(m_RecvPath, row, 1, 1, 2);

	++row;
	m_FeedbackPathLabel = new QLabel(tr("OSC Trigger"), this);
	layout->addWidget(m_FeedbackPathLabel, row, 0);
	m_FeedbackPath = new QLineEdit(this);
	SetToolTips(tr("Trigger this widget via OSC"), m_FeedbackPathLabel, m_FeedbackPath);
	connect(m_FeedbackPath, SIGNAL(editingFinished()), this, SLOT(onEditingFinished()));
	layout->addWidget(m_FeedbackPath, row, 1, 1, 2);

	++row;
	QLabel *label = new QLabel(tr("Icon"), this);
	layout->addWidget(label, row, 0);
	m_ImagePathButton = new FadeButton(this);
	SetToolTips(tr("Image files are referenced relative to the *.oscwidgets.txt file"), label, m_ImagePathButton);
	m_ImagePathButton->setFixedSize(40, 40);
	connect(m_ImagePathButton, SIGNAL(clicked(bool)), this, SLOT(onImagePathButtonClicked(bool)));
	layout->addWidget(m_ImagePathButton, row, 1, 1, 2);

	++row;
	m_HiddenLabel = new QLabel(tr("Hidden"), this);
	layout->addWidget(m_HiddenLabel, row, 0);
	m_Hidden = new QCheckBox(this);
	SetToolTips(tr("Hide this widget"), label, m_ImagePathButton);
	connect(m_Hidden, SIGNAL(stateChanged(int)), this, SLOT(onHiddenStateChanged(int)));
	layout->addWidget(m_Hidden, row, 1, 1, 2);
	
	++row;
	m_Color = new QPushButton(tr("Color..."), this);
	connect(m_Color, SIGNAL(clicked(bool)), this, SLOT(onColorClicked(bool)));
	layout->addWidget(m_Color, row, 0, 1, 3);
	
	++row;
	m_TextColor = new QPushButton(tr("Text Color..."), this);
	connect(m_TextColor, SIGNAL(clicked(bool)), this, SLOT(onTextColorClicked(bool)));
	layout->addWidget(m_TextColor, row, 0, 1, 3);

	++row;
	QPushButton *button = new QPushButton(tr("Done"), this);
	connect(button, SIGNAL(clicked(bool)), this, SLOT(onDoneClicked(bool)));
	layout->addWidget(button, row, 0, 1, 3);

	++row;
	QGroupBox *group = new QGroupBox(tr("Notes"), this);
	group->setFixedWidth(200);
	QGridLayout *groupLayout = new QGridLayout(group);
	layout->addWidget(group, 0, 4, row, 1);

	m_Help = new QLabel(group);
	m_Help->setWordWrap(true);
	m_Help->setAlignment(Qt::AlignTop|Qt::AlignLeft);
	groupLayout->addWidget(m_Help, 0, 0);
}
Exemplo n.º 8
0
UpdateCameraDialog::UpdateCameraDialog(const Camera& camera, QWidget *parent) :
    QDialog(parent) {

    _observerXEdit = new QLineEdit(QString::number(camera._observer[0]), this);
    _observerXEdit->setFixedWidth(50);
    _observerYEdit = new QLineEdit(QString::number(camera._observer[1]), this);
    _observerYEdit->setFixedWidth(50);
    _observerZEdit = new QLineEdit(QString::number(camera._observer[2]), this);
    _observerZEdit->setFixedWidth(50);
    QFormLayout* observerXLayout = new QFormLayout;
    observerXLayout->addRow("X:", _observerXEdit);
    QFormLayout* observerYLayout = new QFormLayout;
    observerYLayout->addRow("Y:", _observerYEdit);
    QFormLayout* observerZLayout = new QFormLayout;
    observerZLayout->addRow("Z:", _observerZEdit);
    QHBoxLayout* observerLayout = new QHBoxLayout;
    observerLayout->addLayout(observerXLayout);
    observerLayout->addLayout(observerYLayout);
    observerLayout->addLayout(observerZLayout);
    QGroupBox* observerGroupBox = new QGroupBox("observer", this);
    observerGroupBox->setFixedWidth(250);
    observerGroupBox->setLayout(observerLayout);

    _aimedPointXEdit = new QLineEdit(QString::number(camera._aimedPoint[0]), this);
    _aimedPointXEdit->setFixedWidth(50);
    _aimedPointYEdit = new QLineEdit(QString::number(camera._aimedPoint[1]), this);
    _aimedPointYEdit->setFixedWidth(50);
    _aimedPointZEdit = new QLineEdit(QString::number(camera._aimedPoint[2]), this);
    _aimedPointZEdit->setFixedWidth(50);
    QFormLayout* aimedPointXLayout = new QFormLayout;
    aimedPointXLayout->addRow("X:", _aimedPointXEdit);
    QFormLayout* aimedPointYLayout = new QFormLayout;
    aimedPointYLayout->addRow("Y:", _aimedPointYEdit);
    QFormLayout* aimedPointZLayout = new QFormLayout;
    aimedPointZLayout->addRow("Z:", _aimedPointZEdit);
    QHBoxLayout* aimedPointLayout = new QHBoxLayout;
    aimedPointLayout->addLayout(aimedPointXLayout);
    aimedPointLayout->addLayout(aimedPointYLayout);
    aimedPointLayout->addLayout(aimedPointZLayout);
    QGroupBox* aimedPointGroupBox = new QGroupBox("aimedPoint", this);
    aimedPointGroupBox->setFixedWidth(250);
    aimedPointGroupBox->setLayout(aimedPointLayout);

    _viewAngleEdit = new QLineEdit(QString::number(camera._viewAngle), this);
    _viewAngleEdit->setFixedWidth(50);
    QFormLayout* viewAngleLayout = new QFormLayout;
    viewAngleLayout->addRow("Value:", _viewAngleEdit);
    QGroupBox* viewAngleGroupBox = new QGroupBox("View angle", this);
    viewAngleGroupBox->setLayout(viewAngleLayout);

    _distanceScreenEdit = new QLineEdit(QString::number(camera._distScreen), this);
    _distanceScreenEdit->setFixedWidth(50);
    QFormLayout* distanceScreenLayout = new QFormLayout;
    distanceScreenLayout->addRow("Value:", _distanceScreenEdit);
    QGroupBox* distanceScreenGroupBox = new QGroupBox("Distance to screen", this);
    distanceScreenGroupBox->setLayout(distanceScreenLayout);

    QVBoxLayout* fieldsLayout = new QVBoxLayout;
    fieldsLayout->setAlignment(Qt::AlignTop);
    fieldsLayout->addWidget(observerGroupBox);
    fieldsLayout->addWidget(aimedPointGroupBox);
    fieldsLayout->addWidget(viewAngleGroupBox);
    fieldsLayout->addWidget(distanceScreenGroupBox);


    _okButton = new QPushButton("Update");
    connect(_okButton, SIGNAL(clicked()), this, SLOT(checkFields()));
    _cancelButton = new QPushButton("Cancel");
    connect(_cancelButton, SIGNAL(clicked()), this, SLOT(reject()));

    QVBoxLayout* buttonsLayout = new QVBoxLayout;
    buttonsLayout->setAlignment(Qt::AlignTop);
    buttonsLayout->addWidget(_okButton);
    buttonsLayout->addWidget(_cancelButton);


    QHBoxLayout* mainLayout = new QHBoxLayout;
    mainLayout->setAlignment(Qt::AlignTop);
    mainLayout->addLayout(fieldsLayout);
    mainLayout->addLayout(buttonsLayout);

    setLayout(mainLayout);
}
Exemplo n.º 9
0
//! [0]
Screenshot::Screenshot()
    :  screenshotLabel(new QLabel(this))
{
    screenshotLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    screenshotLabel->setAlignment(Qt::AlignCenter);

    const QRect screenGeometry = QApplication::desktop()->screenGeometry(this);
    screenshotLabel->setMinimumSize(screenGeometry.width() / 1.5, screenGeometry.height() / 1.5);

    QVBoxLayout *mainLayout = new QVBoxLayout(this);
    mainLayout->addWidget(screenshotLabel);

    QGroupBox *optionsGroupBox = new QGroupBox(tr("Veuillez saisir les données"), this);
    x_spinBox = new QSpinBox(optionsGroupBox);
    x_spinBox->setSuffix(tr(" px"));
    x_spinBox->setMaximum(screenGeometry.width());

    y_spinBox = new QSpinBox(optionsGroupBox);
    y_spinBox->setSuffix(tr(" px"));
    y_spinBox->setMaximum(screenGeometry.height());

    width_spinBox = new QSpinBox(optionsGroupBox);
    width_spinBox->setSuffix(tr(" px"));
    //width_spinBox->setPrefix(tr("Width "));
    width_spinBox->setMaximum(screenGeometry.width());

    height_spinBox = new QSpinBox(optionsGroupBox);
    height_spinBox->setSuffix(tr(" px"));
    height_spinBox->setMaximum(screenGeometry.height());

    optionsGroupBox->setFixedWidth(350);

    typedef void (QSpinBox::*QSpinBoxIntSignal)(int);
    connect(x_spinBox, static_cast<QSpinBoxIntSignal>(&QSpinBox::valueChanged),
            this, &Screenshot::updateCheckBox);

    //hideThisWindowCheckBox = new QCheckBox(tr("Hide This Window"), optionsGroupBox);

    QGridLayout *optionsGroupBoxLayout = new QGridLayout(optionsGroupBox);
    optionsGroupBoxLayout->addWidget(new QLabel(tr("Point de départ :"), this), 0, 0);
    optionsGroupBoxLayout->addWidget(x_spinBox, 0, 1);
    optionsGroupBoxLayout->addWidget(y_spinBox, 0, 2);
    //optionsGroupBoxLayout->addWidget(hideThisWindowCheckBox, 1, 0, 1, 2);
    optionsGroupBoxLayout->addWidget(new QLabel("Dimensions :",this),1,0,1,1);
    optionsGroupBoxLayout->addWidget(width_spinBox,1,1);
    optionsGroupBoxLayout->addWidget(height_spinBox,1,2);

    mainLayout->addWidget(optionsGroupBox);

    QHBoxLayout *buttonsLayout = new QHBoxLayout;
    newScreenshotButton = new QPushButton(tr("Commencer le partage"), this);
    connect(newScreenshotButton, &QPushButton::clicked, this, &Screenshot::newScreenshot);
    buttonsLayout->addWidget(newScreenshotButton);
    QPushButton *quitScreenshotButton = new QPushButton(tr("Quitter"), this);
    quitScreenshotButton->setShortcut(Qt::CTRL + Qt::Key_Q);
    connect(quitScreenshotButton, &QPushButton::clicked, this, &QWidget::close);
    buttonsLayout->addWidget(quitScreenshotButton);
    buttonsLayout->addStretch();
    mainLayout->addLayout(buttonsLayout);

    shootScreen();
    //x_spinBox->setValue(5);

    setWindowTitle(tr("Bureau à distance"));
    resize(300, 200);
    rubberBand = NULL;
}
MangaListWidget::MangaListWidget(QWidget* parent):
  QWidget(parent),
  _scansDirectory(Utils::getScansDirectory()),
  _currentChaptersListOnWeb(),
  _chaptersToCheck(),
  _currentIndex(),
  _editOn(false),
  _coverHasToBeSet(false) {


  /// Available chapters process

  _checkAvailableChaptersProcess = new QProcess(this);
  connect(_checkAvailableChaptersProcess, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(checkAvailableChapterIsDone(int,QProcess::ExitStatus)));
  connect(_checkAvailableChaptersProcess, SIGNAL(readyReadStandardOutput()), this, SLOT(readStandardOutput()));


  /// Top buttons

  _markReadButton = new QPushButton;
  _markReadButton->setIcon(QIcon(Utils::getIconsPath()+"/check.gif"));
  _markReadButton->setFixedWidth(37);
  connect(_markReadButton, SIGNAL(clicked()), this, SLOT(markRead()));

  _markUnreadButton = new QPushButton;
  _markUnreadButton->setIcon(QIcon(Utils::getIconsPath()+"/uncheck.gif"));
  _markUnreadButton->setFixedWidth(37);
  connect(_markUnreadButton, SIGNAL(clicked()), this, SLOT(markUnread()));

  _downloadButton = new QPushButton;
  _downloadButton->setIcon(QIcon(Utils::getIconsPath()+"/download.gif"));
  _downloadButton->setFixedWidth(37);
  connect(_downloadButton, SIGNAL(clicked()), this, SLOT(goToDownload()));

  _addMangaButton = new QPushButton;
  _addMangaButton->setIcon(QIcon(Utils::getIconsPath()+"/plus.png"));
  _addMangaButton->setFixedWidth(37);
  connect(_addMangaButton, SIGNAL(clicked()), this, SLOT(addManga()));

  _checkNewChaptersButton = new QPushButton;
  _checkNewChaptersButton->setIcon(QIcon(Utils::getIconsPath()+"/checkChapters.png"));
  _checkNewChaptersButton->setFixedWidth(37);
  connect(_checkNewChaptersButton, SIGNAL(clicked()), this, SLOT(decorateMangaNames()));

  QHBoxLayout* buttonsLayout = new QHBoxLayout;
  buttonsLayout->addWidget(_markReadButton);
  buttonsLayout->addWidget(_markUnreadButton);
  buttonsLayout->addWidget(_downloadButton);
  buttonsLayout->addWidget(_addMangaButton);
  buttonsLayout->addWidget(_checkNewChaptersButton);
  buttonsLayout->setAlignment(Qt::AlignHCenter);


  /// Manga information

  QPixmap pixmap(Utils::getIconsPath()+"/setCover.png");

  _mangaPreviewLabel = new QLabel;
  _mangaPreviewLabel->setFixedHeight(400);
  _mangaPreviewLabel->setAlignment(Qt::AlignTop | Qt::AlignHCenter);
  _mangaPreviewLabel->setStyleSheet("margin: 20px;");
  _mangaPreviewLabel->setAttribute(Qt::WA_Hover);
  _mangaPreviewLabel->installEventFilter(this);
  _mangaPreviewLabel->setPixmap(pixmap);

  _genreLabel = new QLabel;
  _genreLabel->setFont(QFont("Monospace", 8));
  _authorLabel = new QLabel;
  _authorLabel->setFont(QFont("Monospace", 8));
  _artistLabel = new QLabel;
  _artistLabel->setFont(QFont("Monospace", 8));
  _publisherLabel = new QLabel;
  _publisherLabel->setFont(QFont("Monospace", 8));
  _magazineLabel = new QLabel;
  _magazineLabel->setFont(QFont("Monospace", 8));
  _startDateLabel = new QLabel;
  _startDateLabel->setFont(QFont("Monospace", 8));

  _editMangaInfoButton = new QPushButton("Edit");
  _editMangaInfoButton->setCheckable(true);
  _editMangaInfoButton->setFixedWidth(100);
  connect(_editMangaInfoButton, SIGNAL(toggled(bool)), this, SLOT(toggleEditMangaInfo(bool)));

  QFormLayout* genreLayout = new QFormLayout;
  genreLayout->addRow("Genre:", _genreLabel);
  QFormLayout* authorLayout = new QFormLayout;
  authorLayout->addRow("Author:", _authorLabel);
  QFormLayout* artistLayout = new QFormLayout;
  artistLayout->addRow("Artist:", _artistLabel);
  QFormLayout* publisherLayout = new QFormLayout;
  publisherLayout->addRow("Publisher:", _publisherLabel);
  QFormLayout* magazineLayout = new QFormLayout;
  magazineLayout->addRow("Magazine:", _magazineLabel);
  QFormLayout* startDateLayout = new QFormLayout;
  startDateLayout->addRow("Start date:", _startDateLabel);

  QVBoxLayout* mangaInfoLayout = new QVBoxLayout;
  mangaInfoLayout->addWidget(_mangaPreviewLabel);
  mangaInfoLayout->addLayout(genreLayout);
  mangaInfoLayout->addLayout(authorLayout);
  mangaInfoLayout->addLayout(artistLayout);
  mangaInfoLayout->addLayout(publisherLayout);
  mangaInfoLayout->addLayout(magazineLayout);
  mangaInfoLayout->addLayout(startDateLayout);
  mangaInfoLayout->addWidget(_editMangaInfoButton);
  mangaInfoLayout->setAlignment(Qt::AlignTop);

  QGroupBox* mangaInfoGroupBox = new QGroupBox("Information");
  mangaInfoGroupBox->setLayout(mangaInfoLayout);
  mangaInfoGroupBox->setFixedWidth(350);
  mangaInfoGroupBox->setAlignment(Qt::AlignLeft);


  /// Chapters model

  _model = new QStandardItemModel;
  initModel();


  /// Chapters view

  _chapterInfoWidget = new ChapterInfoWidget;

  _view = new QColumnView;
  QList<int> widths;
  widths << 300 << 400 << 400;
  _view->setColumnWidths(widths);
  _view->setResizeGripsVisible(false);
  _view->setFixedWidth(1102);
  _view->setSelectionMode(QAbstractItemView::ExtendedSelection);
  _view->setModel(_model);
  _view->setPreviewWidget(_chapterInfoWidget);
  connect(_view, SIGNAL(updatePreviewWidget(QModelIndex)), this, SLOT(updateChaptersInfo(QModelIndex)));
  connect(_view, SIGNAL(clicked(QModelIndex)), this, SLOT(updateMangaInfo(QModelIndex)));
  connect(_view, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(goToRead(QModelIndex)));

  QHBoxLayout* listLayout = new QHBoxLayout;
  listLayout->addWidget(mangaInfoGroupBox);
  listLayout->addWidget(_view);

  QStringList headerLabels;
  headerLabels << "Manga";
  _model->setHorizontalHeaderLabels(headerLabels);


  /// Set current index to first manga if any

  _view->setCurrentIndex(_model->index(0, 0));
  updateMangaInfo(_model->index(0, 0));


  /// Main layout

  QLabel* titleLabel = new QLabel("Manga List");
  titleLabel->setFont(QFont("", 18, 99));

  QVBoxLayout* mainLayout = new QVBoxLayout;
  mainLayout->addWidget(titleLabel);
  mainLayout->addLayout(buttonsLayout);
  mainLayout->addLayout(listLayout);

  setLayout(mainLayout);


  /// Schedule a new available manga check every thirty minutes

  QTimer* timer = new QTimer(this);
  connect(timer, SIGNAL(timeout()), this, SLOT(decorateMangaNames()));
  timer->start(1000*60*30);
}