ParagraphIndentSpacing::ParagraphIndentSpacing(QWidget *parent)
        : QWidget(parent),
        m_fontMetricsChecked(false)
{
    widget.setupUi(this);

    connect(widget.first, SIGNAL(valueChangedPt(qreal)), this, SLOT(firstLineMarginChanged(qreal)));
    connect(widget.left, SIGNAL(valueChangedPt(qreal)), this, SLOT(leftMarginChanged(qreal)));
    connect(widget.right, SIGNAL(valueChangedPt(qreal)), this, SLOT(rightMarginChanged(qreal)));

    // Keep order in sync with lineSpacingType() and display()
    widget.lineSpacing->addItem(i18nc("Line spacing value", "Single"));
    widget.lineSpacing->addItem(i18nc("Line spacing value", "1.5 Lines"));
    widget.lineSpacing->addItem(i18nc("Line spacing value", "Double"));
    widget.lineSpacing->addItem(i18nc("Line spacing type", "Proportional"));    // called Proportional like in OO
    widget.lineSpacing->addItem(i18nc("Line spacing type", "Additional"));    // normal distance + absolute value
    widget.lineSpacing->addItem(i18nc("Line spacing type", "Fixed"));
    widget.lineSpacing->addItem(i18nc("Line spacing type", "At least"));

    connect(widget.first, SIGNAL(valueChangedPt(qreal)), this, SLOT(firstIndentValueChanged()));
    connect(widget.left, SIGNAL(valueChangedPt(qreal)), this, SLOT(leftMarginValueChanged()));
    connect(widget.right, SIGNAL(valueChangedPt(qreal)), this, SLOT(rightMarginValueChanged()));
    connect(widget.after, SIGNAL(valueChangedPt(qreal)), this, SLOT(bottomMarginValueChanged()));
    connect(widget.before, SIGNAL(valueChangedPt(qreal)), this, SLOT(topMarginValueChanged()));
    connect(widget.lineSpacing, SIGNAL(currentIndexChanged(int)), this, SLOT(lineSpacingChanged(int)));
    connect(widget.useFont, SIGNAL(toggled(bool)), this, SLOT(useFontMetrices(bool)));
    connect(widget.autoTextIndent, SIGNAL(stateChanged(int)), this, SLOT(autoTextIndentChanged(int)));
    connect(widget.proportional, SIGNAL(valueChanged(int)), this, SLOT(spacingPercentChanged()));
    connect(widget.custom, SIGNAL(valueChangedPt(qreal)), this, SLOT(spacingValueChanged()));
    lineSpacingChanged(0);
}
KoPageLayoutWidget::KoPageLayoutWidget(QWidget *parent, const KoPageLayout &layout)
    : QWidget(parent)
    , d(new Private)
{
    d->widget.setupUi(this);

    d->pageLayout = layout;
    d->marginsEnabled = true;
    d->allowSignals = true;
    d->orientationGroup = new QButtonGroup(this);
    d->orientationGroup->addButton(d->widget.portrait, KoPageFormat::Portrait);
    d->orientationGroup->addButton(d->widget.landscape, KoPageFormat::Landscape);

    QButtonGroup *group2 = new QButtonGroup(this);
    group2->addButton(d->widget.singleSided);
    group2->addButton(d->widget.facingPages);
    // the two sets of labels we use might have different lengths; make sure this does not create a 'jumping' ui
    d->widget.facingPages->setChecked(true);
    facingPagesChanged();
    int width = qMax(d->widget.leftLabel->width(), d->widget.rightLabel->width());
    d->widget.singleSided->setChecked(true);
    facingPagesChanged();
    width = qMax(width, qMax(d->widget.leftLabel->width(), d->widget.rightLabel->width()));
    d->widget.leftLabel->setMinimumSize(QSize(width, 5));

    d->widget.units->addItems(KoUnit::listOfUnitNameForUi(KoUnit::HidePixel));
    d->widget.sizes->addItems(KoPageFormat::localizedPageFormatNames());
    setPageSpread(false);

    connect(d->widget.sizes, SIGNAL(currentIndexChanged(int)), this, SLOT(sizeChanged(int)));
    connect(d->widget.units, SIGNAL(currentIndexChanged(int)), this, SLOT(unitChanged(int)));
    connect(group2, SIGNAL(buttonClicked (int)), this, SLOT(facingPagesChanged()));
    connect(d->orientationGroup, SIGNAL(buttonClicked (int)), this, SLOT(orientationChanged()));
    connect(d->widget.width, SIGNAL(valueChangedPt(qreal)), this, SLOT(optionsChanged()));
    connect(d->widget.height, SIGNAL(valueChangedPt(qreal)), this, SLOT(optionsChanged()));
    connect(d->widget.topMargin, SIGNAL(valueChangedPt(qreal)), this, SLOT(marginsChanged()));
    connect(d->widget.bottomMargin, SIGNAL(valueChangedPt(qreal)), this, SLOT(marginsChanged()));
    connect(d->widget.bindingEdgeMargin, SIGNAL(valueChangedPt(qreal)), this, SLOT(marginsChanged()));
    connect(d->widget.pageEdgeMargin, SIGNAL(valueChangedPt(qreal)), this, SLOT(marginsChanged()));
    connect(d->widget.width, SIGNAL(valueChangedPt(qreal)), this, SLOT(optionsChanged()));
    connect(d->widget.height, SIGNAL(valueChangedPt(qreal)), this, SLOT(optionsChanged()));

    setUnit(KoUnit(KoUnit::Millimeter));
    setPageLayout(layout);
    if (layout.format == 0) // make sure we always call this during startup, even if the A3 (index=0) was chosen
        sizeChanged(layout.format);

    showTextDirection(false);
    /* disable advanced page layout features by default */
    d->widget.facingPageLabel->setVisible(false);
    d->widget.facingPages->setVisible(false);
    d->widget.singleSided->setVisible(false);
    d->widget.stylesLabel->setVisible(false);
    d->widget.pageStyle->setVisible(false);
}
Exemple #3
0
KWFrameGeometry::KWFrameGeometry(FrameConfigSharedState *state)
        : m_state(state),
        m_frame(0),
        m_topOfPage(0),
        m_blockSignals(false),
        m_originalGeometryLock(false)
{
    m_state->addUser();
    widget.setupUi(this);
    setUnit(m_state->document()->unit());
    widget.width->setMinimum(0.0);
    widget.height->setMinimum(0.0);
    widget.leftMargin->setMinimum(0.0);
    widget.rightMargin->setMinimum(0.0);
    widget.bottomMargin->setMinimum(0.0);
    widget.topMargin->setMinimum(0.0);

    widget.keepAspect->setKeepAspectRatio(m_state->keepAspectRatio());

    connect(widget.leftMargin, SIGNAL(valueChangedPt(qreal)), this, SLOT(syncMargins(qreal)));
    connect(widget.rightMargin, SIGNAL(valueChangedPt(qreal)), this, SLOT(syncMargins(qreal)));
    connect(widget.bottomMargin, SIGNAL(valueChangedPt(qreal)), this, SLOT(syncMargins(qreal)));
    connect(widget.topMargin, SIGNAL(valueChangedPt(qreal)), this, SLOT(syncMargins(qreal)));

    connect(widget.width, SIGNAL(valueChangedPt(qreal)), this, SLOT(widthChanged(qreal)));
    connect(widget.height, SIGNAL(valueChangedPt(qreal)), this, SLOT(heightChanged(qreal)));

    connect(m_state, SIGNAL(keepAspectRatioChanged(bool)), widget.keepAspect, SLOT(setKeepAspectRatio(bool)));
    connect(widget.keepAspect, SIGNAL(keepAspectRatioChanged(bool)), this, SLOT(updateAspectRatio(bool)));

    connect(widget.positionSelector, SIGNAL(positionSelected(KFlake::Position)),
            this, SLOT(setGeometryAlignment(KFlake::Position)));

}
ImageExportOptionsWidget::ImageExportOptionsWidget(QSizeF pointSize, QWidget * parent)
        : QWidget(parent), m_pointSize(pointSize)
{
    KoUnit unit;

    widget.setupUi(this);

    widget.pxWidth->setRange(1, 10000);
    widget.pxWidth->setAlignment(Qt::AlignRight);
    widget.pxWidth->setSuffix(" px");
    widget.pxHeight->setRange(1, 10000);
    widget.pxHeight->setAlignment(Qt::AlignRight);
    widget.pxHeight->setSuffix(" px");
    widget.unitWidth->setMinMaxStep(0, 10000, 1);
    widget.unitHeight->setMinMaxStep(0, 10000, 1);
    widget.dpi->setRange(1, 10000);
    widget.dpi->setValue(KoDpi::dpiX());
    widget.dpi->setAlignment(Qt::AlignRight);
    widget.dpi->setSuffix(" DPI");
    widget.pxAspect->setKeepAspectRatio(true);
    widget.unitAspect->setKeepAspectRatio(true);
    widget.unit->addItems(KoUnit::listOfUnitNameForUi(KoUnit::HidePixel));
    widget.unit->setCurrentIndex(unit.indexInListForUi(KoUnit::HidePixel));
    widget.backColor->setColor(Qt::white);
    widget.opacity->setMinimum(0.0);
    widget.opacity->setMaximum(100.0);
    widget.opacity->setValue(0.0);
    widget.unitWidth->changeValue(pointSize.width());
    widget.unitHeight->changeValue(pointSize.height());
    updateFromPointSize(pointSize);

    connect(widget.unitWidth, SIGNAL(valueChangedPt(qreal)), this, SLOT(unitWidthChanged(qreal)));
    connect(widget.unitHeight, SIGNAL(valueChangedPt(qreal)), this, SLOT(unitHeightChanged(qreal)));
    connect(widget.pxWidth, SIGNAL(valueChanged(int)), this, SLOT(pxWidthChanged(int)));
    connect(widget.pxHeight, SIGNAL(valueChanged(int)), this, SLOT(pxHeightChanged(int)));
    connect(widget.dpi, SIGNAL(valueChanged(int)), this, SLOT(dpiChanged(int)));
    connect(widget.unit, SIGNAL(activated(int)), this, SLOT(unitChanged(int)));
    connect(widget.pxAspect, SIGNAL(keepAspectRatioChanged(bool)), this, SLOT(aspectChanged(bool)));
    connect(widget.unitAspect, SIGNAL(keepAspectRatioChanged(bool)), this, SLOT(aspectChanged(bool)));
}
KWDocumentColumns::KWDocumentColumns(QWidget *parent, const KoColumns &columns)
        : QWidget(parent)
{
    widget.setupUi(this);

    setColumns(columns);
    setUnit(KoUnit(KoUnit::Millimeter));

    QGridLayout *layout = new QGridLayout(widget.previewPane);
    layout->setMargin(0);
    widget.previewPane->setLayout(layout);
    m_preview = new KoPagePreviewWidget(this);
    layout->addWidget(m_preview);
    m_preview->setColumns(columns);

    connect(widget.columns, SIGNAL(valueChanged(int)), this, SLOT(optionsChanged()));
    connect(widget.spacing, SIGNAL(valueChangedPt(qreal)), this, SLOT(optionsChanged()));
    connect(this, SIGNAL(columnsChanged(const KoColumns&)), m_preview, SLOT(setColumns(const KoColumns&)));
}
KoShadowConfigWidget::KoShadowConfigWidget( QWidget * parent )
    : QWidget( parent ), d( new Private() )
{
    d->widget.setupUi(this);
    d->widget.shadowOffset->setValue( 10.0 );
    d->widget.shadowAngle->setValue( 45.0 );
    d->widget.shadowAngle->setMinimum( 0.0 );
    d->widget.shadowAngle->setMaximum( 360.0 );
    d->widget.shadowOptions->setEnabled( false );

    d->actionShadowColor = new KoColorPopupAction(this);
    d->widget.shadowColor->setDefaultAction(d->actionShadowColor);

    connect( d->widget.shadowVisible, SIGNAL(toggled(bool)), this, SLOT(visibilityChanged()) );
    connect( d->widget.shadowVisible, SIGNAL(toggled(bool)), this, SIGNAL(shadowVisibilityChanged(bool)) );
    connect( d->actionShadowColor, SIGNAL(colorChanged(const KoColor&)), 
        this, SIGNAL(shadowColorChanged(const KoColor&)));
    connect( d->widget.shadowAngle, SIGNAL(valueChanged(qreal,bool)), this, SLOT(offsetChanged()));
    connect( d->widget.shadowOffset, SIGNAL(valueChangedPt(qreal)), this, SLOT(offsetChanged()));
}
GuidesToolOptionWidget::GuidesToolOptionWidget(QWidget *parent)
    :QWidget(parent)
{
    widget.setupUi(this);

    widget.orientation->addItem(i18n("Horizontal"));
    widget.orientation->addItem(i18n("Vertical"));
    widget.orientation->setCurrentIndex(0);
    widget.addButton->setIcon(koIcon("list-add"));
    widget.removeButton->setIcon(koIcon("list-remove"));

    widget.position->setUnit(m_unit);

    connect(widget.orientation, SIGNAL(currentIndexChanged(int)),
             this, SLOT(updateList(int)));
    connect(widget.positionList, SIGNAL(currentRowChanged(int)),
             this, SLOT(updatePosition(int)));
    connect(widget.position, SIGNAL(valueChangedPt(qreal)),
             this, SLOT(positionChanged(qreal)));
    connect(widget.removeButton, SIGNAL(clicked(bool)),
             this, SLOT(removeLine()));
    connect(widget.addButton, SIGNAL(clicked(bool)),
             this, SLOT(addLine()));
}
Exemple #8
0
void KoUnitDoubleSpinBox::privateValueChanged() {
    emit valueChangedPt( value () );
}
Exemple #9
0
StrokeDocker::StrokeDocker()
    : d( new Private() )
{
    setWindowTitle( i18n( "Stroke Properties" ) );

    QWidget *mainWidget = new QWidget( this );
    QGridLayout *mainLayout = new QGridLayout( mainWidget );

    QLabel * styleLabel = new QLabel( i18n( "Style:" ), mainWidget );
    mainLayout->addWidget( styleLabel, 0, 0 );
    d->lineStyle = new KoLineStyleSelector( mainWidget );
    mainLayout->addWidget( d->lineStyle, 0, 1, 1, 3 );

    connect( d->lineStyle, SIGNAL(currentIndexChanged( int ) ), this, SLOT( styleChanged() ) );

    QLabel* widthLabel = new QLabel( i18n ( "Width:" ), mainWidget );
    mainLayout->addWidget( widthLabel, 1, 0 );
    // set min/max/step and value in points, then set actual unit
    d->setLineWidth = new KoUnitDoubleSpinBox( mainWidget );
    d->setLineWidth->setMinMaxStep( 0.0, 1000.0, 0.5 );
    d->setLineWidth->setDecimals( 2 );
    d->setLineWidth->setUnit( KoUnit(KoUnit::Point) );
    d->setLineWidth->setToolTip( i18n( "Set line width of actual selection" ) );
    mainLayout->addWidget( d->setLineWidth, 1, 1, 1, 3 );
    connect( d->setLineWidth, SIGNAL( valueChangedPt( qreal ) ), this, SLOT( widthChanged() ) );

    QLabel* capLabel = new QLabel( i18n ( "Cap:" ), mainWidget );
    mainLayout->addWidget( capLabel, 2, 0 );
    d->capGroup = new QButtonGroup( mainWidget );
    d->capGroup->setExclusive( true );
    d->capGroup->setExclusive( true );

    QRadioButton *button = 0;

    button = new QRadioButton( mainWidget );
    button->setIcon( SmallIcon( "cap_butt" ) );
    button->setCheckable( true );
    button->setToolTip( i18n( "Butt cap" ) );
    d->capGroup->addButton( button, Qt::FlatCap );
    mainLayout->addWidget( button, 2, 1 );

    button = new QRadioButton( mainWidget );
    button->setIcon( SmallIcon( "cap_round" ) );
    button->setCheckable( true );
    button->setToolTip( i18n( "Round cap" ) );
    d->capGroup->addButton( button, Qt::RoundCap );
    mainLayout->addWidget( button, 2, 2 );

    button = new QRadioButton( mainWidget );
    button->setIcon( SmallIcon( "cap_square" ) );
    button->setCheckable( true );
    button->setToolTip( i18n( "Square cap" ) );
    d->capGroup->addButton( button, Qt::SquareCap );
    mainLayout->addWidget( button, 2, 3 );

    connect( d->capGroup, SIGNAL( buttonClicked( int ) ), this, SLOT( slotCapChanged( int ) ) );

    QLabel* joinLabel = new QLabel( i18n ( "Join:" ), mainWidget );
    mainLayout->addWidget( joinLabel, 3, 0 );

    d->joinGroup = new QButtonGroup( mainWidget );
    d->joinGroup->setExclusive( true );

    button = new QRadioButton( mainWidget );
    button->setIcon( SmallIcon( "join_miter" ) );
    button->setCheckable( true );
    button->setToolTip( i18n( "Miter join" ) );
    d->joinGroup->addButton( button, Qt::MiterJoin );
    mainLayout->addWidget( button, 3, 1 );

    button = new QRadioButton( mainWidget );
    button->setIcon( SmallIcon( "join_round" ) );
    button->setCheckable( true );
    button->setToolTip( i18n( "Round join" ) );
    d->joinGroup->addButton( button, Qt::RoundJoin );
    mainLayout->addWidget( button, 3, 2 );

    button = new QRadioButton( mainWidget );
    button->setIcon( SmallIcon( "join_bevel" ) );
    button->setCheckable( true );
    button->setToolTip( i18n( "Bevel join" ) );
    d->joinGroup->addButton( button, Qt::BevelJoin );
    mainLayout->addWidget( button, 3, 3 );

    connect( d->joinGroup, SIGNAL( buttonClicked( int ) ), this, SLOT( slotJoinChanged( int ) ) );

    QLabel* miterLabel = new QLabel( i18n ( "Miter limit:" ), mainWidget );
    mainLayout->addWidget( miterLabel, 4, 0 );
    // set min/max/step and value in points, then set actual unit
    d->miterLimit = new KoUnitDoubleSpinBox( mainWidget );
    d->miterLimit->setMinMaxStep( 0.0, 1000.0, 0.5 );
    d->miterLimit->setDecimals( 2 );
    d->miterLimit->setUnit( KoUnit(KoUnit::Point) );
    d->miterLimit->setToolTip( i18n( "Set miter limit" ) );
    mainLayout->addWidget( d->miterLimit, 4, 1, 1, 3 );
    connect( d->miterLimit, SIGNAL( valueChangedPt( qreal ) ), this, SLOT( miterLimitChanged() ) );

    mainLayout->setRowStretch( 5, 1 );
    mainLayout->setColumnStretch( 1, 1 );
    mainLayout->setColumnStretch( 2, 1 );
    mainLayout->setColumnStretch( 3, 1 );

    setWidget( mainWidget );

    updateControls();
}