r14214 by cbradney - More changes to Document Setup new prefs pane
scribus-commit
scribus-commit at lists.scribus.net
Thu Oct 22 22:35:23 CEST 2009
Revision: 14214
Author: cbradney
Date: 2009-10-22T17:33:01.779811Z
Commit message: More changes to Document Setup new prefs pane
Changeset:
M /trunk/Scribus/scribus/ui/prefs_documentsetup.cpp
M /trunk/Scribus/scribus/ui/prefs_documentsetup.h
M /trunk/Scribus/scribus/ui/prefs_documentsetupbase.ui
Diffs:
Index: scribus/ui/prefs_documentsetup.h
===================================================================
--- scribus/ui/prefs_documentsetup.h (revision 14213)
+++ scribus/ui/prefs_documentsetup.h (revision 14214)
@@ -11,6 +11,7 @@
#include "ui_prefs_documentsetupbase.h"
#include "prefs_pane.h"
#include "scribusapi.h"
+#include "scribusstructs.h"
class SCRIBUS_API Prefs_DocumentSetup : public Prefs_Pane, Ui::Prefs_DocumentSetup
{
@@ -24,14 +25,17 @@
public slots:
void languageChange();
+ void pageLayoutChanged(int);
private:
void unitChange();
+ void setupPageSets();
double unitRatio;
int choosenLayout;
double pageW;
double pageH;
QString prefsPageSizeName;
+ QList<PageSet> pageSets;
};
#endif // PREFS_DOCUMENTSETUP_H
Index: scribus/ui/prefs_documentsetup.cpp
===================================================================
--- scribus/ui/prefs_documentsetup.cpp (revision 14213)
+++ scribus/ui/prefs_documentsetup.cpp (revision 14214)
@@ -4,6 +4,7 @@
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
+#include <QButtonGroup>
#include "prefs_documentsetup.h"
#include "commonstrings.h"
@@ -19,6 +20,13 @@
pageWidthSpinBox->setMaximum(16777215);
pageHeightSpinBox->setMaximum(16777215);
languageChange();
+
+ pageLayoutButtonGroup->setId(singlePageRadioButton,0);
+ pageLayoutButtonGroup->setId(doublePageRadioButton,1);
+ pageLayoutButtonGroup->setId(threeFoldRadioButton,2);
+ pageLayoutButtonGroup->setId(fourFoldRadioButton,3);
+
+ connect(pageLayoutButtonGroup, SIGNAL(buttonReleased(int)), this, SLOT(pageLayoutChanged(int)));
}
Prefs_DocumentSetup::~Prefs_DocumentSetup()
@@ -49,6 +57,9 @@
pageUnitsComboBox->clear();
pageUnitsComboBox->addItems(unitGetTextUnitList());
pageUnitsComboBox->setCurrentIndex(i<0?0:i);
+
+ setupPageSets();
+
}
void Prefs_DocumentSetup::restoreDefaults(struct ApplicationPrefs *prefsData)
@@ -70,11 +81,27 @@
pageWidthSpinBox->setValue(pageW * unitRatio);
pageHeightSpinBox->setValue(pageH * unitRatio);
- /*
- docLayout->selectItem(prefsData->docSetupPrefs.pagePositioning);
- docLayout->firstPage->setCurrentIndex(prefsData->pageSets[prefsData->docSetupPrefs.pagePositioning].FirstPage);
+ pageSets=prefsData->pageSets;
+ switch (prefsData->docSetupPrefs.pagePositioning)
+ {
+ case 0:
+ singlePageRadioButton->setChecked(true);
+ break;
+ case 1:
+ doublePageRadioButton->setChecked(true);
+ break;
+ case 2:
+ threeFoldRadioButton->setChecked(true);
+ break;
+ case 3:
+ fourFoldRadioButton->setChecked(true);
+ break;
+ }
+ setupPageSets();
+ layoutFirstPageIsComboBox->setCurrentIndex(prefsData->pageSets[prefsData->docSetupPrefs.pagePositioning].FirstPage);
+/*
marginGroup->setNewMargins(prefsData->docSetupPrefs.margins);
marginGroup->setPageWidthHeight(prefsData->docSetupPrefs.pageWidth, prefsData->docSetupPrefs.pageHeight);
marginGroup->setPageSize(prefsPageSizeName);
@@ -92,13 +119,28 @@
void Prefs_DocumentSetup::saveGuiToPrefs(struct ApplicationPrefs *prefsData) const
{
- /*
- pageSizeComboBox
- pageOrientationComboBox
- pageUnitsComboBox
- pageWidthSpinBox
- pageHeightSpinBox
- */
+ prefsData->docSetupPrefs.pageSize=prefsPageSizeName;
+ prefsData->docSetupPrefs.pageOrientation=pageOrientationComboBox->currentIndex();
+ prefsData->docSetupPrefs.pageWidth=pageW;
+ prefsData->docSetupPrefs.pageHeight=pageH;
+ prefsData->docSetupPrefs.pagePositioning=pageLayoutButtonGroup->checkedId();
+ prefsData->pageSets[prefsData->docSetupPrefs.pagePositioning].FirstPage=layoutFirstPageIsComboBox->currentIndex();
}
+void Prefs_DocumentSetup::setupPageSets()
+{
+ int i=layoutFirstPageIsComboBox->currentIndex();
+ layoutFirstPageIsComboBox->clear();
+ int currIndex=pageLayoutButtonGroup->checkedId()<0?0:pageLayoutButtonGroup->checkedId();
+ if (currIndex>=0 && currIndex<pageSets.count())
+ for(QStringList::Iterator pNames = pageSets[currIndex].pageNames.begin(); pNames != pageSets[currIndex].pageNames.end(); ++pNames )
+ layoutFirstPageIsComboBox->addItem(CommonStrings::translatePageSetLocString(*pNames));
+ layoutFirstPageIsComboBox->setCurrentIndex(i<0?0:i);
+}
+void Prefs_DocumentSetup::pageLayoutChanged(int /*i*/)
+{
+ setupPageSets();
+ layoutFirstPageIsComboBox->setCurrentIndex(pageSets[pageLayoutButtonGroup->checkedId()].FirstPage);
+}
+
Index: scribus/ui/prefs_documentsetupbase.ui
===================================================================
--- scribus/ui/prefs_documentsetupbase.ui (revision 14213)
+++ scribus/ui/prefs_documentsetupbase.ui (revision 14214)
@@ -201,6 +201,12 @@
<property name="text">
<string>Single Page</string>
</property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ <attribute name="buttonGroup">
+ <string>pageLayoutButtonGroup</string>
+ </attribute>
</widget>
</item>
<item row="1" column="0" colspan="2">
@@ -208,6 +214,9 @@
<property name="text">
<string>Double Page</string>
</property>
+ <attribute name="buttonGroup">
+ <string>pageLayoutButtonGroup</string>
+ </attribute>
</widget>
</item>
<item row="2" column="0" colspan="2">
@@ -215,6 +224,9 @@
<property name="text">
<string>3-Fold</string>
</property>
+ <attribute name="buttonGroup">
+ <string>pageLayoutButtonGroup</string>
+ </attribute>
</widget>
</item>
<item row="3" column="0" colspan="2">
@@ -222,6 +234,9 @@
<property name="text">
<string>4-Fold</string>
</property>
+ <attribute name="buttonGroup">
+ <string>pageLayoutButtonGroup</string>
+ </attribute>
</widget>
</item>
<item row="4" column="0">
@@ -404,4 +419,7 @@
</customwidgets>
<resources/>
<connections/>
+ <buttongroups>
+ <buttongroup name="pageLayoutButtonGroup"/>
+ </buttongroups>
</ui>
More information about the scribus-commit
mailing list