r14764 by cbradney - #8615: Enable saving to compressed file by preference option

scribus-commit scribus-commit at lists.scribus.net
Thu Feb 18 23:20:29 CET 2010


Revision: 14764
Author: cbradney
Date: 2010-02-18T22:17:48.738936Z
Commit message: #8615: Enable saving to compressed file by preference option

Changeset: 
M  /trunk/Scribus/scribus/prefsmanager.cpp
M  /trunk/Scribus/scribus/scribus.cpp
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/prefsmanager.cpp
===================================================================
--- scribus/prefsmanager.cpp	(revision 14763)
+++ scribus/prefsmanager.cpp	(revision 14764)
@@ -334,7 +334,7 @@
 	appPrefs.hyphPrefs.AutoCheck = false;
 	appPrefs.docSetupPrefs.AutoSave = true;
 	appPrefs.docSetupPrefs.AutoSaveTime = 600000;
-
+	appPrefs.docSetupPrefs.saveCompressed = false;
 	int dpi = qApp->desktop()->logicalDpiX();
 	if ((dpi < 60) || (dpi > 200))
 		dpi = 72;
@@ -1445,6 +1445,7 @@
 	dc76.setAttribute("DOPPEL", appPrefs.docSetupPrefs.pagePositioning);
 	dc76.setAttribute("AutoSave", static_cast<int>(appPrefs.docSetupPrefs.AutoSave));
 	dc76.setAttribute("AutoSaveTime", appPrefs.docSetupPrefs.AutoSaveTime);
+	dc76.setAttribute("SaveCompressed", static_cast<int>(appPrefs.docSetupPrefs.saveCompressed));
 	dc76.setAttribute("BleedTop", ScCLocale::toQStringC(appPrefs.docSetupPrefs.bleeds.Top));
 	dc76.setAttribute("BleedLeft", ScCLocale::toQStringC(appPrefs.docSetupPrefs.bleeds.Left));
 	dc76.setAttribute("BleedRight", ScCLocale::toQStringC(appPrefs.docSetupPrefs.bleeds.Right));
@@ -2066,6 +2067,7 @@
 			appPrefs.docSetupPrefs.pagePositioning    = dc.attribute("DOPPEL", "0").toInt();
 			appPrefs.docSetupPrefs.AutoSave      = static_cast<bool>(dc.attribute("AutoSave", "0").toInt());
 			appPrefs.docSetupPrefs.AutoSaveTime  = dc.attribute("AutoSaveTime", "600000").toInt();
+			appPrefs.docSetupPrefs.saveCompressed = static_cast<bool>(dc.attribute("SaveCompressed", "0").toInt());
 			appPrefs.docSetupPrefs.bleeds.Top    = ScCLocale::toDoubleC(dc.attribute("BleedTop"), 0.0);
 			appPrefs.docSetupPrefs.bleeds.Left   = ScCLocale::toDoubleC(dc.attribute("BleedLeft"), 0.0);
 			appPrefs.docSetupPrefs.bleeds.Right  = ScCLocale::toDoubleC(dc.attribute("BleedRight"), 0.0);
Index: scribus/ui/prefs_documentsetup.h
===================================================================
--- scribus/ui/prefs_documentsetup.h	(revision 14763)
+++ scribus/ui/prefs_documentsetup.h	(revision 14764)
@@ -48,6 +48,7 @@
 		 */
 		void setSize(const QString & gr);
 		void setPageSize();
+		void slotUndo(bool);
 		void unitChange();
 
 	private:
Index: scribus/ui/prefs_documentsetup.cpp
===================================================================
--- scribus/ui/prefs_documentsetup.cpp	(revision 14763)
+++ scribus/ui/prefs_documentsetup.cpp	(revision 14764)
@@ -10,7 +10,10 @@
 #include "commonstrings.h"
 #include "ui/newmarginwidget.h"
 #include "pagesize.h"
+#include "prefsfile.h"
+#include "prefsmanager.h"
 #include "prefsstructs.h"
+#include "undomanager.h"
 #include "units.h"
 #include "util.h"
 
@@ -40,6 +43,7 @@
 	connect(pageHeightSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setPageHeight(double)));
 	connect(pageLayoutButtonGroup, SIGNAL(buttonReleased(int)), this, SLOT(pageLayoutChanged(int)));
 	connect(pageUnitsComboBox, SIGNAL(activated(int)), this, SLOT(unitChange()));
+	connect(undoCheckBox, SIGNAL(toggled(bool)), this, SLOT(slotUndo(bool)));
 }
 
 Prefs_DocumentSetup::~Prefs_DocumentSetup()
@@ -146,10 +150,15 @@
 	bleedsWidget->setPageHeight(prefsData->docSetupPrefs.pageHeight);
 	bleedsWidget->setPageSize(prefsPageSizeName);
 	bleedsWidget->setMarginPreset(prefsData->docSetupPrefs.marginPreset);
-/*
-	GroupAS->setChecked( prefsData->docSetupPrefs.AutoSave );
-	ASTime->setValue(prefsData->docSetupPrefs.AutoSaveTime / 1000 / 60);
-	*/
+	saveCompressedCheckBox->setChecked(prefsData->docSetupPrefs.saveCompressed);
+	autosaveCheckBox->setChecked( prefsData->docSetupPrefs.AutoSave );
+	autosaveIntervalSpinBox->setValue(prefsData->docSetupPrefs.AutoSaveTime / 1000 / 60);
+	undoCheckBox->setChecked(PrefsManager::instance()->prefsFile->getContext("undo")->getBool("enabled", true));
+	int undoLength = UndoManager::instance()->getHistoryLength();
+	if (undoLength == -1)
+		undoLengthSpinBox->setEnabled(false);
+	else
+		undoLengthSpinBox->setValue(undoLength);
 	unitChange();
 }
 
@@ -163,6 +172,16 @@
 	prefsData->pageSets[prefsData->docSetupPrefs.pagePositioning].FirstPage=layoutFirstPageIsComboBox->currentIndex();
 	prefsData->docSetupPrefs.margins=marginsWidget->margins();
 	prefsData->docSetupPrefs.bleeds=bleedsWidget->margins();
+	prefsData->docSetupPrefs.saveCompressed=saveCompressedCheckBox->isChecked();
+	prefsData->docSetupPrefs.AutoSave=autosaveCheckBox->isChecked();
+	prefsData->docSetupPrefs.AutoSaveTime = autosaveIntervalSpinBox->value() * 1000 * 60;
+	bool undoActive=undoCheckBox->isChecked();
+	if (!undoActive)
+		UndoManager::instance()->clearStack();
+	UndoManager::instance()->setUndoEnabled(undoActive);
+	UndoManager::instance()->setAllHistoryLengths(undoLengthSpinBox->value());
+	static PrefsContext *undoPrefs = PrefsManager::instance()->prefsFile->getContext("undo");
+	undoPrefs->set("enabled", undoActive);
 }
 
 void Prefs_DocumentSetup::setupPageSets()
@@ -262,3 +281,8 @@
 	pageHeightSpinBox->blockSignals(false);
 	delete ps2;
 }
+
+void Prefs_DocumentSetup::slotUndo(bool isEnabled)
+{
+	undoLengthSpinBox->setEnabled(isEnabled);
+}
Index: scribus/ui/prefs_documentsetupbase.ui
===================================================================
--- scribus/ui/prefs_documentsetupbase.ui	(revision 14763)
+++ scribus/ui/prefs_documentsetupbase.ui	(revision 14764)
@@ -38,7 +38,7 @@
    <item>
     <widget class="QTabWidget" name="tabWidget">
      <property name="currentIndex">
-      <number>2</number>
+      <number>0</number>
      </property>
      <widget class="QWidget" name="tab">
       <attribute name="title">
@@ -175,7 +175,7 @@
           </font>
          </property>
          <property name="text">
-          <string>Page Layouts</string>
+          <string>Page Layout</string>
          </property>
         </widget>
        </item>
@@ -266,7 +266,7 @@
      </widget>
      <widget class="QWidget" name="tab_2">
       <attribute name="title">
-       <string>Margins and Bleeds</string>
+       <string>Margins &amp;&amp; Bleeds</string>
       </attribute>
       <layout class="QVBoxLayout" name="verticalLayout_3">
        <item>
@@ -389,7 +389,7 @@
          <property name="sizeHint" stdset="0">
           <size>
            <width>20</width>
-           <height>20</height>
+           <height>0</height>
           </size>
          </property>
         </spacer>
@@ -448,7 +448,7 @@
        <item>
         <widget class="QCheckBox" name="autosaveCheckBox">
          <property name="text">
-          <string>Autosave</string>
+          <string>Enable Automatic Saving of Documents</string>
          </property>
         </widget>
        </item>
@@ -523,7 +523,7 @@
        <item>
         <widget class="QCheckBox" name="undoCheckBox">
          <property name="text">
-          <string>Undo/Redo</string>
+          <string>Enable Undo/Redo System</string>
          </property>
         </widget>
        </item>
Index: scribus/scribus.cpp
===================================================================
--- scribus/scribus.cpp	(revision 14763)
+++ scribus/scribus.cpp	(revision 14764)
@@ -4277,6 +4277,8 @@
 			fna = wdir;
 		fna += doc->DocName + ".sla";
 	}
+	if (prefsManager->appPrefs.docSetupPrefs.saveCompressed)
+		fna.append(".gz");
 	QString fileSpec=tr("Documents (*.sla *.sla.gz);;All Files (*)");
 // 	bool setter=true;
 	int optionFlags = fdCompressFile | fdHidePreviewCheckBox;




More information about the scribus-commit mailing list