void Prefs_DocumentSetup::languageChange()
{
	int i=0;

	i=pageOrientationComboBox->currentIndex();
	pageOrientationComboBox->clear();
	pageOrientationComboBox->addItem( tr( "Portrait" ) );
	pageOrientationComboBox->addItem( tr( "Landscape" ) );
	pageOrientationComboBox->setCurrentIndex(i<0?0:i);

	i=pageUnitsComboBox->currentIndex();
	pageUnitsComboBox->clear();
	pageUnitsComboBox->addItems(unitGetTextUnitList());
	pageUnitsComboBox->setCurrentIndex(i<0?0:i);

	setupPageSets();

	pageWidthSpinBox->setToolTip( "<qt>" + tr( "Width of document pages, editable if you have chosen a custom page size" ) + "</qt>" );
	pageHeightSpinBox->setToolTip( "<qt>" + tr( "Height of document pages, editable if you have chosen a custom page size" ) + "</qt>" );
	pageSizeComboBox->setToolTip( "<qt>" + tr( "Default page size, either a standard size or a custom size. More page sizes can be made visible by activating them in Preferences." ) + "</qt>" );
	pageSizeLinkToolButton->setToolTip( "<qt>" + tr( "Enable or disable more page sizes by jumping to Page Size preferences" ) + "</qt>" );
	pageOrientationComboBox->setToolTip( "<qt>" + tr( "Default orientation of document pages" ) + "</qt>" );
	pageUnitsComboBox->setToolTip( "<qt>" + tr( "Default unit of measurement for document editing" ) + "</qt>" );
	autosaveCheckBox->setToolTip( "<qt>" + tr( "When enabled, Scribus saves a backup copy of your file with the .bak extension each time the time period elapses" ) + "</qt>" );
	autosaveIntervalSpinBox->setToolTip( "<qt>" + tr( "Time period between saving automatically" ) + "</qt>" );
	undoLengthSpinBox->setToolTip( "<qt>" + tr("Set the length of the action history in steps. If set to 0 infinite amount of actions will be stored.") + "</qt>");
	applySizesToAllPagesCheckBox->setToolTip( "<qt>" + tr( "Apply the page size changes to all existing pages in the document" ) + "</qt>" );
	applyMarginsToAllPagesCheckBox->setToolTip( "<qt>" + tr( "Apply the page size changes to all existing master pages in the document" ) + "</qt>" );
}
Esempio n. 2
0
void NewDoc::createNewDocPage()
{
	newDocFrame = new QFrame(this);

	pageSizeGroupBox = new QGroupBox(newDocFrame );
	pageSizeGroupBox->setTitle( tr( "Document Layout" ) );
	pageSizeGroupBoxLayout = new QGridLayout( pageSizeGroupBox );
	pageSizeGroupBoxLayout->setMargin(10);
	pageSizeGroupBoxLayout->setSpacing(5);
	pageSizeGroupBoxLayout->setAlignment( Qt::AlignTop );

	layoutsView = new PageLayoutsWidget( pageSizeGroupBox );
	layoutsView->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
	for (int pg = 0; pg < prefsManager->appPrefs.pageSets.count(); ++pg)
	{
		QListWidgetItem *ic;
		QString psname=CommonStrings::translatePageSetString(prefsManager->appPrefs.pageSets[pg].Name);
		if (pg == 0)
		{
			ic = new QListWidgetItem( QIcon(loadIcon("32/page-simple.png")), psname, layoutsView );
			ic->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
		}
		else if (pg == 1)
		{
			ic = new QListWidgetItem( QIcon(loadIcon("32/page-doublesided.png")), psname, layoutsView );
			ic->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
		}
		else if (pg == 2)
		{
			ic = new QListWidgetItem( QIcon(loadIcon("32/page-3fold.png")), psname, layoutsView );
			ic->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
		}
		else if (pg == 3)
		{
			ic = new QListWidgetItem( QIcon(loadIcon("32/page-4fold.png")), psname, layoutsView );
			ic->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
		}
		else
		{
			ic = new QListWidgetItem( QIcon(loadIcon("32/page-simple.png")), psname, layoutsView );
			ic->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
		}
	}
	layoutsView->arrangeIcons();
	pageSizeGroupBoxLayout->addWidget( layoutsView, 0, 0, 5, 1 );
	layoutsView->arrangeIcons();


	TextLabel1 = new QLabel( tr( "&Size:" ), pageSizeGroupBox );
	pageSizeGroupBoxLayout->addWidget( TextLabel1, 0, 1 );
	PageSize ps(prefsManager->appPrefs.pageSize);
	pageSizeComboBox = new QComboBox( pageSizeGroupBox );
	pageSizeComboBox->addItems(ps.sizeTRList());
	pageSizeComboBox->addItem( CommonStrings::trCustomPageSize );
	pageSizeComboBox->setEditable(false);
	TextLabel1->setBuddy(pageSizeComboBox);
	pageSizeGroupBoxLayout->addWidget(pageSizeComboBox, 0, 2 );
	TextLabel2 = new QLabel( tr( "Orie&ntation:" ), pageSizeGroupBox );
	pageSizeGroupBoxLayout->addWidget( TextLabel2, 1, 1 );
	pageOrientationComboBox = new QComboBox( pageSizeGroupBox );
	pageOrientationComboBox->addItem( tr( "Portrait" ) );
	pageOrientationComboBox->addItem( tr( "Landscape" ) );
	pageOrientationComboBox->setEditable(false);
	pageOrientationComboBox->setCurrentIndex(prefsManager->appPrefs.pageOrientation);
	TextLabel2->setBuddy(pageOrientationComboBox);
	pageSizeGroupBoxLayout->addWidget( pageOrientationComboBox, 1, 2 );

	TextLabel1_2 = new QLabel( tr( "&Width:" ), pageSizeGroupBox );
	pageSizeGroupBoxLayout->addWidget(TextLabel1_2, 2, 1 );
	widthSpinBox = new ScrSpinBox( 1, 16777215, pageSizeGroupBox, m_unitIndex );
	widthSpinBox->setSuffix(m_unitSuffix);
	TextLabel1_2->setBuddy(widthSpinBox);
	pageSizeGroupBoxLayout->addWidget(widthSpinBox, 2, 2 );
	TextLabel2_2 = new QLabel( tr( "&Height:" ), pageSizeGroupBox );
	pageSizeGroupBoxLayout->addWidget(TextLabel2_2, 3, 1 );
	heightSpinBox = new ScrSpinBox( 1, 16777215, pageSizeGroupBox, m_unitIndex );
	heightSpinBox->setSuffix(m_unitSuffix);
	TextLabel2_2->setBuddy(heightSpinBox);
	pageSizeGroupBoxLayout->addWidget(heightSpinBox, 3, 2 );
	layoutLabel1 = new QLabel( pageSizeGroupBox );
	layoutLabel1->setText( tr( "First Page is:" ) );
	pageSizeGroupBoxLayout->addWidget( layoutLabel1, 4, 1 );
	firstPage = new ScComboBox( pageSizeGroupBox );
	firstPage->clear();
	pageSizeGroupBoxLayout->addWidget( firstPage, 4, 2 );
	selectItem(prefsManager->appPrefs.FacingPages);
	firstPage->setCurrentIndex(prefsManager->appPrefs.pageSets[prefsManager->appPrefs.FacingPages].FirstPage);

	MarginStruct marg(prefsManager->appPrefs.margins);
	marginGroup = new MarginWidget(newDocFrame,  tr( "Margin Guides" ), &marg, m_unitIndex );
	marginGroup->setPageWidthHeight(prefsManager->appPrefs.PageWidth, prefsManager->appPrefs.PageHeight);
	marginGroup->setFacingPages(!(prefsManager->appPrefs.FacingPages == singlePage));
	widthSpinBox->setValue(prefsManager->appPrefs.PageWidth * m_unitRatio);
	heightSpinBox->setValue(prefsManager->appPrefs.PageHeight * m_unitRatio);
	QStringList pageSizes=ps.sizeList();
	int sizeIndex=pageSizes.indexOf(ps.nameTR());
	if (sizeIndex!=-1)
		pageSizeComboBox->setCurrentIndex(sizeIndex);
	else
		pageSizeComboBox->setCurrentIndex(pageSizeComboBox->count()-1);
	marginGroup->setPageSize(pageSizeComboBox->currentText());
	setDocLayout(prefsManager->appPrefs.FacingPages);
	setSize(prefsManager->appPrefs.pageSize);
	setOrientation(prefsManager->appPrefs.pageOrientation);
	marginGroup->setNewBleeds(prefsManager->appPrefs.bleeds);
	marginGroup->setMarginPreset(prefsManager->appPrefs.marginPreset);

	optionsGroupBox = new QGroupBox( newDocFrame );
	optionsGroupBox->setTitle( tr( "Options" ) );
	optionsGroupBoxLayout = new QFormLayout( optionsGroupBox );
	optionsGroupBoxLayout->setSpacing( 5 );
	optionsGroupBoxLayout->setMargin( 10 );
	optionsGroupBoxLayout->setAlignment( Qt::AlignTop );
	optionsGroupBoxLayout->setFormAlignment(Qt::AlignLeft | Qt::AlignTop);
	optionsGroupBoxLayout->setLabelAlignment(Qt::AlignLeft);
	pageCountLabel = new QLabel( tr( "N&umber of Pages:" ), optionsGroupBox );

	pageCountSpinBox = new QSpinBox( optionsGroupBox );
	pageCountSpinBox->setMaximum( 10000 );
	pageCountSpinBox->setMinimum( 1 );
	pageCountLabel->setBuddy(pageCountSpinBox);
	unitOfMeasureLabel = new QLabel( tr( "&Default Unit:" ), optionsGroupBox );
	unitOfMeasureComboBox = new QComboBox( optionsGroupBox );
	unitOfMeasureComboBox->addItems(unitGetTextUnitList());
	unitOfMeasureComboBox->setCurrentIndex(m_unitIndex);
	unitOfMeasureComboBox->setEditable(false);
	unitOfMeasureLabel->setBuddy(unitOfMeasureComboBox);
	optionsGroupBoxLayout->addRow( pageCountLabel, pageCountSpinBox);
	optionsGroupBoxLayout->addRow( unitOfMeasureLabel, unitOfMeasureComboBox );

	autoTextFrame = new QCheckBox( optionsGroupBox );
	autoTextFrame->setText( tr( "&Automatic Text Frames" ) );
	optionsGroupBoxLayout->addRow( autoTextFrame );
	TextLabel3 = new QLabel( tr( "Colu&mns:" ), optionsGroupBox );
	numberOfCols = new QSpinBox( optionsGroupBox );
	numberOfCols->setButtonSymbols( QSpinBox::UpDownArrows );
	numberOfCols->setMinimum( 1 );
	numberOfCols->setValue( 1 );
	TextLabel3->setBuddy(numberOfCols);
	optionsGroupBoxLayout->addRow( TextLabel3, numberOfCols );

	TextLabel4 = new QLabel( tr( "&Gap:" ), optionsGroupBox );
	Distance = new ScrSpinBox( 0, 1000, optionsGroupBox, m_unitIndex );
	Distance->setValue(11 * m_unitRatio);
	m_distance = 11;
	optionsGroupBoxLayout->addRow( TextLabel4, Distance );
	TextLabel4->setBuddy(Distance);

	TextLabel3->setEnabled(false);
	TextLabel4->setEnabled(false);
	Distance->setEnabled(false);
	numberOfCols->setEnabled(false);
	startDocSetup = new QCheckBox( optionsGroupBox );
	startDocSetup->setText( tr( "Show Document Settings After Creation" ) );
	startDocSetup->setChecked(false);
	optionsGroupBoxLayout->addRow( startDocSetup );
	NewDocLayout = new QGridLayout( newDocFrame );
	NewDocLayout->setMargin(10);
	NewDocLayout->setSpacing(5);
	NewDocLayout->addWidget( marginGroup, 1, 0 );
	NewDocLayout->addWidget( optionsGroupBox, 1, 1 );
	NewDocLayout->addWidget( pageSizeGroupBox, 0, 0, 1, 2);
}
Esempio n. 3
0
void Prefs_Display::restoreDefaults(struct ApplicationPrefs *prefsData)
{
	docUnitIndex = prefsData->docSetupPrefs.docUnitIndex;
	double unitRatio = unitGetRatioFromIndex(docUnitIndex);
	QString unitSuffix = unitGetSuffixFromIndex(docUnitIndex);

	showImagesCheckBox->setChecked(prefsData->guidesPrefs.showPic);
	showControlCharsCheckBox->setChecked(prefsData->guidesPrefs.showControls);
	showRulersCheckBox->setChecked(prefsData->guidesPrefs.rulersShown);
	showRulersRelativeToPageCheckBox->setChecked(prefsData->guidesPrefs.rulerMode);
	showTextChainsCheckBox->setChecked(prefsData->guidesPrefs.linkShown);
	showFramesCheckBox->setChecked(prefsData->guidesPrefs.framesShown);
	showLayerIndicatorsCheckBox->setChecked(prefsData->guidesPrefs.layerMarkersShown);
	showUnprintableAreaInMarginColorCheckBox->setChecked(prefsData->displayPrefs.marginColored);
	showBleedAreaCheckBox->setChecked(prefsData->guidesPrefs.showBleed);
	showPageShadowCheckBox->setChecked(prefsData->displayPrefs.showPageShadow);
	showVerifierWarningsOnCanvasCheckBox->setChecked(prefsData->displayPrefs.showVerifierWarningsOnCanvas);

	scratchSpaceLeftSpinBox->setMaximum(1000);
	scratchSpaceRightSpinBox->setMaximum(1000);
	scratchSpaceTopSpinBox->setMaximum(1000);
	scratchSpaceBottomSpinBox->setMaximum(1000);
	pageGapHorizontalSpinBox->setMaximum(1000);
	pageGapVerticalSpinBox->setMaximum(1000);
	scratchSpaceLeftSpinBox->setNewUnit(docUnitIndex);
	scratchSpaceRightSpinBox->setNewUnit(docUnitIndex);
	scratchSpaceTopSpinBox->setNewUnit(docUnitIndex);
	scratchSpaceBottomSpinBox->setNewUnit(docUnitIndex);
	pageGapHorizontalSpinBox->setNewUnit(docUnitIndex);
	pageGapVerticalSpinBox->setNewUnit(docUnitIndex);


	scratchSpaceLeftSpinBox->setValue(prefsData->displayPrefs.scratch.Left * unitRatio);
	scratchSpaceRightSpinBox->setValue(prefsData->displayPrefs.scratch.Right * unitRatio);
	scratchSpaceTopSpinBox->setValue(prefsData->displayPrefs.scratch.Top * unitRatio);
	scratchSpaceBottomSpinBox->setValue(prefsData->displayPrefs.scratch.Bottom * unitRatio);
	pageGapHorizontalSpinBox->setValue(prefsData->displayPrefs.pageGapHorizontal);
	pageGapVerticalSpinBox->setValue(prefsData->displayPrefs.pageGapVertical);

	QPixmap pm(100, 30);
	pm.fill(prefsData->displayPrefs.paperColor);
	colorPaper = prefsData->displayPrefs.paperColor;
	pageFillColorButton->setText( QString::null );
	pageFillColorButton->setIcon(pm);


	pm.fill(prefsData->displayPrefs.frameColor);
	colorFrame = prefsData->displayPrefs.frameColor;
	frameSelectedColorButton->setText( QString::null );
	frameSelectedColorButton->setIcon(pm);

	pm.fill(prefsData->displayPrefs.frameNormColor);
	colorFrameNorm = prefsData->displayPrefs.frameNormColor;
	frameColorButton->setText( QString::null );
	frameColorButton->setIcon(pm);

	pm.fill(prefsData->displayPrefs.frameGroupColor);
	colorFrameGroup = prefsData->displayPrefs.frameGroupColor;
	frameGroupedColorButton->setText( QString::null );
	frameGroupedColorButton->setIcon(pm);

	pm.fill(prefsData->displayPrefs.frameLinkColor);
	colorFrameLinked = prefsData->displayPrefs.frameLinkColor;
	frameLinkedColorButton->setText( QString::null );
	frameLinkedColorButton->setIcon(pm);

	pm.fill(prefsData->displayPrefs.frameLockColor);
	colorFrameLocked = prefsData->displayPrefs.frameLockColor;
	frameLockedColorButton->setText( QString::null );
	frameLockedColorButton->setIcon(pm);

	pm.fill(prefsData->displayPrefs.frameAnnotationColor);
	colorFrameAnnotation = prefsData->displayPrefs.frameAnnotationColor;
	frameAnnotationColorButton->setText( QString::null );
	frameAnnotationColorButton->setIcon(pm);

	pm.fill(prefsData->displayPrefs.pageBorderColor);
	colorPageBorder = prefsData->displayPrefs.pageBorderColor;
	selectedPageBorderButton->setText( QString::null );
	selectedPageBorderButton->setIcon(pm);

	pm.fill(prefsData->displayPrefs.controlCharColor);
	colorControlChars = prefsData->displayPrefs.controlCharColor;
	textControlCharsButton->setText( QString::null );
	textControlCharsButton->setIcon(pm);

	displayScale=prefsData->displayPrefs.displayScale;

	adjustDisplaySlider->setValue(qRound(100 * displayScale) - 150);
	displayDPI->setText(QString::number(qRound(displayScale*72.0))+ tr(" dpi"));
	rulerUnitComboBox->clear();
	rulerUnitComboBox->addItems(unitGetTextUnitList());
	rulerUnitComboBox->setCurrentIndex(docUnitIndex);
	drawRuler();

}