r15117 by cbradney - #9199: convert unicode importing to be like the text importer, plus other updates for prefs
scribus-commit
scribus-commit at lists.scribus.net
Thu May 27 00:10:36 CEST 2010
Revision: 15117
Author: cbradney
Date: 2010-05-26T22:00:20.537226Z
Commit message: #9199: convert unicode importing to be like the text importer, plus other updates for prefs
Changeset:
M /trunk/Scribus/scribus/scribus.cpp
M /trunk/Scribus/scribus/plugins/gettext/csvim/csvim.h
M /trunk/Scribus/scribus/ui/preferencesdialog.cpp
M /trunk/Scribus/scribus/ui/prefs_hyphenatorbase.ui
M /trunk/Scribus/scribus/plugins/gettext/csvim/csvim.cpp
M /trunk/Scribus/scribus/ui/prefs_pdfexport.cpp
Diffs:
Index: scribus/ui/prefs_pdfexport.cpp
===================================================================
--- scribus/ui/prefs_pdfexport.cpp (revision 15116)
+++ scribus/ui/prefs_pdfexport.cpp (revision 15117)
@@ -516,6 +516,8 @@
useDocumentBleedsCheckBox->setChecked(Opts.useDocBleeds);
doDocBleeds();
}
+ else
+ useDocumentBleedsCheckBox->hide();
registrationMarkOffsetSpinBox->setValue(prefsData->pdfPrefs.markOffset*unitRatio);
printCropMarksCheckBox->setChecked(prefsData->pdfPrefs.cropMarks);
Index: scribus/ui/prefs_hyphenatorbase.ui
===================================================================
--- scribus/ui/prefs_hyphenatorbase.ui (revision 15116)
+++ scribus/ui/prefs_hyphenatorbase.ui (revision 15117)
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>740</width>
- <height>665</height>
+ <width>608</width>
+ <height>573</height>
</rect>
</property>
<property name="windowTitle">
@@ -45,8 +45,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>712</width>
- <height>594</height>
+ <width>580</width>
+ <height>503</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
@@ -273,19 +273,6 @@
<property name="spacing">
<number>5</number>
</property>
- <item row="1" column="3">
- <spacer>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
<item row="0" column="0" colspan="4">
<widget class="QListWidget" name="exceptionListWidget"/>
</item>
@@ -310,6 +297,19 @@
</property>
</widget>
</item>
+ <item row="1" column="3">
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
</layout>
</widget>
</item>
@@ -328,7 +328,7 @@
<item row="0" column="0" colspan="4">
<widget class="QListWidget" name="ignoreListWidget">
<property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
+ <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@@ -374,19 +374,6 @@
</item>
</layout>
</item>
- <item>
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
</layout>
</widget>
</widget>
Index: scribus/ui/preferencesdialog.cpp
===================================================================
--- scribus/ui/preferencesdialog.cpp (revision 15116)
+++ scribus/ui/preferencesdialog.cpp (revision 15117)
@@ -222,8 +222,8 @@
if (prefs_DocumentItemAttributes) prefs_DocumentItemAttributes->saveGuiToPrefs(&localPrefs);
if (prefs_TableOfContents) prefs_TableOfContents->saveGuiToPrefs(&localPrefs);
if (prefs_DocumentSections) prefs_DocumentSections->saveGuiToPrefs(&localPrefs);
- if (prefs_ColorManagement) prefs_KeyboardShortcuts->saveGuiToPrefs(&localPrefs);
- if (prefs_KeyboardShortcuts) prefs_ColorManagement->saveGuiToPrefs(&localPrefs);
+ if (prefs_KeyboardShortcuts) prefs_KeyboardShortcuts->saveGuiToPrefs(&localPrefs);
+ if (prefs_ColorManagement) prefs_ColorManagement->saveGuiToPrefs(&localPrefs);
if (prefs_Scrapbook) prefs_Scrapbook->saveGuiToPrefs(&localPrefs);
if (prefs_Display) prefs_Display->saveGuiToPrefs(&localPrefs);
if (prefs_ExternalTools) prefs_ExternalTools->saveGuiToPrefs(&localPrefs);
Index: scribus/scribus.cpp
===================================================================
--- scribus/scribus.cpp (revision 15116)
+++ scribus/scribus.cpp (revision 15117)
@@ -862,7 +862,6 @@
scrMenuMgr->addMenuSeparator("Insert");
scrMenuMgr->addMenuItem(scrActions["insertSampleText"], "Insert", false);
-// scrActions["insertFrame"]->setEnabled(false);
//Page menu
scrMenuMgr->createMenu("Page", ActionManager::defaultMenuNameEntryTranslated("Page"));
@@ -879,8 +878,6 @@
scrMenuMgr->addMenuSeparator("Page");
scrMenuMgr->addMenuItem(scrActions["viewSnapToGrid"], "Page", true);
scrMenuMgr->addMenuItem(scrActions["viewSnapToGuides"], "Page", true);
-// scrActions["pageDelete"]->setEnabled(false);
-// scrActions["pageMove"]->setEnabled(false);
//View menu
scrMenuMgr->createMenu("View", ActionManager::defaultMenuNameEntryTranslated("View"));
@@ -909,8 +906,6 @@
scrMenuMgr->addMenuItem(scrActions["viewRulerMode"], "View", true);
scrMenuMgr->addMenuItem(scrActions["showMouseCoordinates"], "View", true);
-// scrActions["viewShowRulers"]->setEnabled(false);
-
//CB If this is viewNewView imeplemented, it should be on the windows menu
// scrMenuMgr->addMenuItem(scrActions["viewNewView"], "View");
@@ -938,14 +933,11 @@
scrMenuMgr->addMenuItem(scrActions["extrasHyphenateText"], "Extras", false);
scrMenuMgr->addMenuItem(scrActions["extrasDeHyphenateText"], "Extras", false);
scrMenuMgr->addMenuItem(scrActions["extrasGenerateTableOfContents"], "Extras", false);
-
scrMenuMgr->setMenuEnabled("Extras", false);
-// scrActions["extrasHyphenateText"]->setEnabled(false);
-// scrActions["extrasDeHyphenateText"]->setEnabled(false);
connect(scrMenuMgr->getLocalPopupMenu("Extras"), SIGNAL(aboutToShow()), this, SLOT(extrasMenuAboutToShow()));
//Window menu
- scrMenuMgr->createMenu("Windows", ActionManager::defaultMenuNameEntryTranslated("Windows"), QString::null, true);
+ scrMenuMgr->createMenu("Windows", ActionManager::defaultMenuNameEntryTranslated("Windows"), QString::null, true);
connect(scrMenuMgr->getLocalPopupMenu("Windows"), SIGNAL(aboutToShow()), this, SLOT(windowsMenuAboutToShow()));
addDefaultWindowMenuItems();
@@ -971,18 +963,13 @@
scrMenuMgr->addMenuToMenuBar("File");
scrMenuMgr->addMenuToMenuBar("Edit");
scrMenuMgr->addMenuToMenuBar("Item");
-// scrMenuMgr->setMenuEnabled("Item", false);
scrMenuMgr->addMenuToMenuBar("Insert");
scrMenuMgr->setMenuEnabled("Insert", false);
scrMenuMgr->addMenuToMenuBar("Page");
-// scrMenuMgr->setMenuEnabled("Page", false);
scrMenuMgr->addMenuToMenuBar("View");
-// scrMenuMgr->setMenuEnabled("View", false);
- //scrMenuMgr->addMenuToMenuBar("Tools");
scrMenuMgr->addMenuToMenuBar("Extras");
scrMenuMgr->setMenuEnabled("Extras", false);
scrMenuMgr->addMenuToMenuBar("Windows");
- //scrMenuMgr->setMenuEnabled("Windows", false);
menuBar()->addSeparator();
scrMenuMgr->addMenuToMenuBar("Help");
}
Index: scribus/plugins/gettext/csvim/csvim.cpp
===================================================================
--- scribus/plugins/gettext/csvim/csvim.cpp (revision 15116)
+++ scribus/plugins/gettext/csvim/csvim.cpp (revision 15117)
@@ -9,6 +9,7 @@
#include "gtparagraphstyle.h"
#include "gtframestyle.h"
#include "scribusstructs.h"
+#include "util.h"
QString FileFormatName()
{
@@ -92,6 +93,7 @@
void CsvIm::loadFile()
{
QString text = "";
+ /*
QFile f(filename);
QFileInfo fi(f);
if (!fi.exists())
@@ -105,8 +107,13 @@
text += QChar(bb[posi]);
}
text = toUnicode(text);
+ */
+ QByteArray rawText;
+ if (loadRawText(filename, rawText))
+ text = toUnicode(rawText);
+
QStringList lines = text.split("\n", QString::SkipEmptyParts);
- uint i;
+ uint i=0;
if (hasHeader)
{
colIndex = 0;
@@ -116,8 +123,6 @@
i = 1;
++rowNumber;
}
- else
- i = 0;
for (int i2 = i; i2 < lines.size(); ++i2)
{
colIndex = 0;
@@ -217,7 +222,7 @@
curValue += addition;
}
}
-
+/*
QString CsvIm::toUnicode(const QString& text)
{
QTextCodec *codec;
@@ -228,6 +233,17 @@
QString dec = codec->toUnicode(text.toLocal8Bit());
return dec;
}
+*/
+QString CsvIm::toUnicode(const QByteArray& rawText)
+{
+ QTextCodec *codec;
+ if (encoding.isEmpty())
+ codec = QTextCodec::codecForLocale();
+ else
+ codec = QTextCodec::codecForName(encoding.toLocal8Bit());
+ QString unistr = codec->toUnicode(rawText);
+ return unistr;
+}
CsvIm::~CsvIm()
{
Index: scribus/plugins/gettext/csvim/csvim.h
===================================================================
--- scribus/plugins/gettext/csvim/csvim.h (revision 15116)
+++ scribus/plugins/gettext/csvim/csvim.h (revision 15117)
@@ -51,7 +51,7 @@
gtParagraphStyle *pstyleHeader;
void loadFile();
void parseLine(const QString& line, bool isHeader);
- QString toUnicode(const QString& text);
+ QString toUnicode(const QByteArray& rawText);
void setupPStyles();
void setupTabulators();
};
More information about the scribus-commit
mailing list