r14091 by cbradney - Allow new scrapbook prefs pane to load/save data

scribus-commit scribus-commit at lists.scribus.net
Sun Oct 4 22:45:19 CEST 2009


Revision: 14091
Author: cbradney
Date: 2009-10-04T20:46:12.741352Z
Commit message: Allow new scrapbook prefs pane to load/save data

Changeset: 
M  /trunk/Scribus/scribus/ui/preferencesdialog.cpp
M  /trunk/Scribus/scribus/ui/prefs_scrapbook.cpp
M  /trunk/Scribus/scribus/ui/prefs_scrapbook.h
M  /trunk/Scribus/scribus/ui/prefs_scrapbookbase.ui

Diffs:
Index: scribus/ui/prefs_scrapbookbase.ui
===================================================================
--- scribus/ui/prefs_scrapbookbase.ui	(revision 14090)
+++ scribus/ui/prefs_scrapbookbase.ui	(revision 14091)
@@ -15,7 +15,7 @@
   </property>
   <layout class="QVBoxLayout" name="verticalLayout">
    <item>
-    <widget class="QLabel" name="label">
+    <widget class="QLabel" name="titleLabel">
      <property name="font">
       <font>
        <pointsize>14</pointsize>
@@ -51,14 +51,14 @@
       </property>
       <layout class="QVBoxLayout" name="verticalLayout_2">
        <item>
-        <widget class="QCheckBox" name="checkBox">
+        <widget class="QCheckBox" name="autoSendCopiedToScrapCheckBox">
          <property name="text">
           <string>Send Copied Items Automatically to the Scrapbook</string>
          </property>
         </widget>
        </item>
        <item>
-        <widget class="QCheckBox" name="checkBox_2">
+        <widget class="QCheckBox" name="keepCopiedAcrossSessionsCheckBox">
          <property name="text">
           <string>Keep Copied Items Permanently Across Sessions</string>
          </property>
@@ -70,14 +70,17 @@
           <enum>QLayout::SetDefaultConstraint</enum>
          </property>
          <item>
-          <widget class="QLabel" name="label_2">
+          <widget class="QLabel" name="itemCountKeptInScrapbookLabel">
            <property name="text">
             <string>Number of Copied Items to Keep in Scrapbook</string>
            </property>
+           <property name="buddy">
+            <cstring>itemCountKeptInScrapbookSpinBox</cstring>
+           </property>
           </widget>
          </item>
          <item>
-          <widget class="QSpinBox" name="spinBox"/>
+          <widget class="QSpinBox" name="itemCountKeptInScrapbookSpinBox"/>
          </item>
          <item>
           <spacer name="horizontalSpacer">
Index: scribus/ui/prefs_scrapbook.cpp
===================================================================
--- scribus/ui/prefs_scrapbook.cpp	(revision 14090)
+++ scribus/ui/prefs_scrapbook.cpp	(revision 14091)
@@ -6,15 +6,39 @@
 */
 
 #include "prefs_scrapbook.h"
+#include "prefsstructs.h"
 
 Prefs_Scrapbook::Prefs_Scrapbook(QWidget* parent)
-	: QWidget(parent)
+	: Prefs_Pane(parent)
 {
 	setupUi(this);
-
+	languageChange();
 }
 
 Prefs_Scrapbook::~Prefs_Scrapbook()
 {
 }
 
+void Prefs_Scrapbook::languageChange()
+{
+	autoSendCopiedToScrapCheckBox->setToolTip( "<qt>" + tr( "" ) + "</qt>");
+	keepCopiedAcrossSessionsCheckBox->setToolTip( "<qt>" + tr( "" ) + "</qt>" );
+	itemCountKeptInScrapbookSpinBox->setToolTip( "<qt>" + tr("") + "</qt>");
+}
+
+void Prefs_Scrapbook::restoreDefaults(struct ApplicationPrefs *prefsData)
+{
+
+	autoSendCopiedToScrapCheckBox->setChecked(prefsData->scrapbookPrefs.doCopyToScrapbook);
+	keepCopiedAcrossSessionsCheckBox->setChecked(prefsData->scrapbookPrefs.persistentScrapbook);
+	itemCountKeptInScrapbookSpinBox->setValue(prefsData->scrapbookPrefs.numScrapbookCopies);
+
+}
+
+void Prefs_Scrapbook::saveGuiToPrefs(struct ApplicationPrefs *prefsData) const
+{
+	prefsData->scrapbookPrefs.doCopyToScrapbook=autoSendCopiedToScrapCheckBox->isChecked();
+	prefsData->scrapbookPrefs.persistentScrapbook=keepCopiedAcrossSessionsCheckBox->isChecked();
+	prefsData->scrapbookPrefs.numScrapbookCopies=itemCountKeptInScrapbookSpinBox->value();
+}
+
Index: scribus/ui/prefs_scrapbook.h
===================================================================
--- scribus/ui/prefs_scrapbook.h	(revision 14090)
+++ scribus/ui/prefs_scrapbook.h	(revision 14091)
@@ -9,15 +9,21 @@
 #define PREFS_SCRAPBOOK_H
 
 #include "ui_prefs_scrapbookbase.h"
+#include "prefs_pane.h"
 #include "scribusapi.h"
 
-class SCRIBUS_API Prefs_Scrapbook : public QWidget, Ui::Prefs_Scrapbook
+class SCRIBUS_API Prefs_Scrapbook : public Prefs_Pane, Ui::Prefs_Scrapbook
 {
 	Q_OBJECT
 
 	public:
 		Prefs_Scrapbook(QWidget* parent=0);
 		~Prefs_Scrapbook();
+		virtual void restoreDefaults(struct ApplicationPrefs *prefsData);
+		virtual void saveGuiToPrefs(struct ApplicationPrefs *prefsData) const;
+
+	public slots:
+		void languageChange();
 };
 
 #endif // PREFS_SCRAPBOOK_H
Index: scribus/ui/preferencesdialog.cpp
===================================================================
--- scribus/ui/preferencesdialog.cpp	(revision 14090)
+++ scribus/ui/preferencesdialog.cpp	(revision 14091)
@@ -104,6 +104,7 @@
 
 void PreferencesDialog::setupGui()
 {
+	prefs_Scrapbook->restoreDefaults(&localPrefs);
 	prefs_Display->restoreDefaults(&localPrefs);
 }
 
@@ -228,6 +229,7 @@
 
 void PreferencesDialog::saveGuiToPrefs()
 {
+	prefs_Scrapbook->saveGuiToPrefs(&localPrefs);
 	prefs_Display->saveGuiToPrefs(&localPrefs);
 }
 




More information about the scribus-commit mailing list