r17578 by craig - #10202: Fix some GUI string translation issues

scribus-commit scribus-commit at lists.scribus.net
Sun Jun 17 18:38:39 UTC 2012


Author: craig
Date: Sun Jun 17 18:38:39 2012
New Revision: 17578

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17578
Log:
#10202: Fix some GUI string translation issues

Modified:
    trunk/Scribus/scribus/canvas.cpp
    trunk/Scribus/scribus/pageitem_textframe.cpp
    trunk/Scribus/scribus/pageitem_textframe.h
    trunk/Scribus/scribus/plugins/saveastemplateplugin/satdialog.cpp
    trunk/Scribus/scribus/plugins/saveastemplateplugin/satdialog.h
    trunk/Scribus/scribus/plugins/saveastemplateplugin/satdialog.ui
    trunk/Scribus/scribus/plugins/saveastemplateplugin/satemplate.cpp
    trunk/Scribus/scribus/plugins/saveastemplateplugin/satemplate.h
    trunk/Scribus/scribus/ui/copypagetomasterpagedialog.cpp

Modified: trunk/Scribus/scribus/canvas.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17578&path=/trunk/Scribus/scribus/canvas.cpp
==============================================================================
--- trunk/Scribus/scribus/canvas.cpp (original)
+++ trunk/Scribus/scribus/canvas.cpp Sun Jun 17 18:38:39 2012
@@ -310,6 +310,8 @@
 	extraS = (item->visualHeight() - item->height()) / - 2.0;
 //	if (item->lineColor() != CommonStrings::None)
 //		extraS = (item->lineWidth() / -2.0);
+	if (item->isTextFrame() && (m_doc->appMode == modeEdit) && !item->asTextFrame()->availableRegion().contains(item->getTransform().inverted().map(canvasPoint.toPoint())))
+		return OUTSIDE;
 	Canvas::FrameHandle result = frameHitTest(item->getTransform().inverted().map(canvasPoint), QRectF(extraS, extraS, item->visualWidth(), item->visualHeight()));
 //	qDebug() << "frameHitTest for item" << item->ItemNr 
 //		<< item->getTransform().inverted().map(canvasPoint) 

Modified: trunk/Scribus/scribus/pageitem_textframe.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17578&path=/trunk/Scribus/scribus/pageitem_textframe.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_textframe.cpp (original)
+++ trunk/Scribus/scribus/pageitem_textframe.cpp Sun Jun 17 18:38:39 2012
@@ -174,7 +174,7 @@
 	return  res;
 }
 
-QRegion PageItem_TextFrame::availableRegion()
+QRegion PageItem_TextFrame::calcAvailableRegion()
 {
 	QRegion result(this->Clip);
 	if ((!isEmbedded) || (Parent != NULL))
@@ -1356,8 +1356,8 @@
 	if ((itemText.length() != 0)) // || (NextBox != 0))
 	{
 		// determine layout area
-		QRegion cl = availableRegion();
-		if (cl.isEmpty())
+		m_availableRegion = calcAvailableRegion();
+		if (m_availableRegion.isEmpty())
 		{
 			MaxChars = firstInFrame();
 			goto NoRoom;
@@ -1376,7 +1376,7 @@
 				matrix.translate(0, Height);
 				matrix.scale(1, -1);
 			}
-			cl = matrix.map(cl);
+			m_availableRegion = matrix.map(m_availableRegion);
 		}
 		
 		current.nextColumn();
@@ -1878,9 +1878,9 @@
 					while (Xpos <= Xend && Xpos < current.colRight)
 					{
 						pt.moveTopLeft(QPoint(static_cast<int>(floor(Xpos)),maxYAsc));
-						if (!regionContainsRect(cl, pt))
+						if (!regionContainsRect(m_availableRegion, pt))
 						{
-							Xpos = current.xPos = realEnd = findRealOverflowEnd(cl, pt, current.colRight);
+							Xpos = current.xPos = realEnd = findRealOverflowEnd(m_availableRegion, pt, current.colRight);
 							Xend = current.xPos + (addIndent2overflow ? current.leftIndent : 0);
 							//for first paragraph`s line - if first line offset should be added
 							if ( addFirstIndent2overflow && (a==0 || (a > 0 && (itemText.text(a-1) == SpecialChars::PARSEP))))
@@ -2240,9 +2240,9 @@
 					pt2 = QPoint(charEnd, maxYDesc);
 				}
 				pt = QRect(pt1, pt2);
-				if (!regionContainsRect(cl, pt))
-				{
-					realEnd = findRealOverflowEnd(cl, pt, current.colRight);
+				if (!regionContainsRect(m_availableRegion, pt))
+				{
+					realEnd = findRealOverflowEnd(m_availableRegion, pt, current.colRight);
 					outs = true;
 				}
 				else if (style.rightMargin() > 0.0)
@@ -2251,9 +2251,9 @@
 						//condition after || is for find overflows in right margin area
 					{
 						pt.translate(static_cast<int>(ceil(style.rightMargin())), 0);
-						if (!regionContainsRect(cl, pt))
+						if (!regionContainsRect(m_availableRegion, pt))
 						{
-							realEnd = findRealOverflowEnd(cl, pt, current.colRight);
+							realEnd = findRealOverflowEnd(m_availableRegion, pt, current.colRight);
 							outs = true;
 						}
 					}
@@ -2399,7 +2399,7 @@
 				{
 					// find end of line
 					current.breakLine(itemText, style, firstLineOffset(), a);
-					EndX = current.endOfLine(cl, style.rightMargin(), maxYAsc, maxYDesc);
+					EndX = current.endOfLine(m_availableRegion, style.rightMargin(), maxYAsc, maxYDesc);
 					current.finishLine(EndX);
 					//addLine = true;
 					assert(current.addLine);
@@ -2476,7 +2476,7 @@
 						current.updateHeightMetrics(itemText);
 						//current.updateLineOffset(itemText, style, firstLineOffset());
 						//current.xPos = current.breakXPos;
-						EndX = current.endOfLine(cl, current.rightMargin, maxYAsc, maxYDesc);
+						EndX = current.endOfLine(m_availableRegion, current.rightMargin, maxYAsc, maxYDesc);
 						current.finishLine(EndX);
 						
 						hyphWidth = 0.0;
@@ -2710,7 +2710,7 @@
 			maxYAsc = qMax(maxYAsc, 0);
 			maxYDesc = static_cast<int>(ceil(current.yPos + qMax(realDesc, desc)));
 
-			EndX = current.endOfLine(cl, style.rightMargin(), maxYAsc, maxYDesc);
+			EndX = current.endOfLine(m_availableRegion, style.rightMargin(), maxYAsc, maxYDesc);
 			current.finishLine(EndX);
 
 			if (opticalMargins & ParagraphStyle::OM_RightHangingPunct)

Modified: trunk/Scribus/scribus/pageitem_textframe.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17578&path=/trunk/Scribus/scribus/pageitem_textframe.h
==============================================================================
--- trunk/Scribus/scribus/pageitem_textframe.h (original)
+++ trunk/Scribus/scribus/pageitem_textframe.h Sun Jun 17 18:38:39 2012
@@ -76,15 +76,16 @@
 	int firstTextItem() const { return itemText.firstFrameItem; }
 	int lastTextItem() const { return itemText.lastFrameItem; }
 #endif
-	
+	QRegion availableRegion() { return m_availableRegion; }
 protected:
+	QRegion calcAvailableRegion();
+	QRegion m_availableRegion;
 	virtual void DrawObj_Item(ScPainter *p, QRectF e);
 	virtual void DrawObj_Post(ScPainter *p);
 	virtual void DrawObj_Decoration(ScPainter *p);
 	//void drawOverflowMarker(ScPainter *p);
 	void drawUnderflowMarker(ScPainter *p);
 	void drawColumnBorders(ScPainter *p);
-	QRegion availableRegion();
 
 #ifdef NLS_PROTO
 	void DrawLineItem(ScPainter *p, double width,

Modified: trunk/Scribus/scribus/plugins/saveastemplateplugin/satdialog.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17578&path=/trunk/Scribus/scribus/plugins/saveastemplateplugin/satdialog.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/saveastemplateplugin/satdialog.cpp (original)
+++ trunk/Scribus/scribus/plugins/saveastemplateplugin/satdialog.cpp Sun Jun 17 18:38:39 2012
@@ -36,7 +36,7 @@
 	};
 };
 
-satdialog::satdialog(QWidget* parent, QString tmplName, int pageW, int pageH) : QDialog(parent)
+SATDialog::SATDialog(QWidget* parent, QString tmplName, int pageW, int pageH) : QDialog(parent)
 {
 	setupUi(this);
 	setModal(true);
@@ -54,7 +54,7 @@
 	connect(detailButton, SIGNAL(stateChanged(int)), this, SLOT(detailClicked(int)));
 }
 
-void satdialog::detailClicked(int state)
+void SATDialog::detailClicked(int state)
 {
 	isFullDetail = state == Qt::Checked;
 
@@ -74,7 +74,7 @@
 	emailEdit->setVisible(isFullDetail);
 }
 
-void satdialog::readPrefs()
+void SATDialog::readPrefs()
 {
 	prefs = PrefsManager::instance()->prefsFile->getPluginContext("satemplate");
 	author = prefs->get("author", "");
@@ -84,14 +84,14 @@
 	detailButton->setCheckState(isFullDetail ? Qt::Checked : Qt::Unchecked);
 }
 
-void satdialog::writePrefs()
+void SATDialog::writePrefs()
 {
 	prefs->set("author", authorEdit->text());
 	prefs->set("email", emailEdit->text());
 	prefs->set("isFullDetail", isFullDetail);
 }
 
-QString satdialog::findTemplateXml(QString dir)
+QString SATDialog::findTemplateXml(QString dir)
 {
 	QString lang = ScCore->getGuiLanguage();
 	QString tmp = dir + "/template." + lang + ".xml";
@@ -107,7 +107,7 @@
 	return dir + "/template.xml";	
 }
 
-void satdialog::addCategories(const QString& dir)
+void SATDialog::addCategories(const QString& dir)
 {
 	// Read categories from the dir itself
 	QString tmplFile = findTemplateXml(dir);
@@ -129,7 +129,7 @@
 	}
 }
 
-void satdialog::readCategories(const QString& fileName)
+void SATDialog::readCategories(const QString& fileName)
 {
 	QFile file(fileName);
 	CategoriesReader catReader;
@@ -146,7 +146,7 @@
 	}
 }
 
-void satdialog::setupCategories() 
+void SATDialog::setupCategories()
 {
 	// en will be used in template.xml and it will be then replaced with the lang when used for users
 	// to get the categories in their language.
@@ -194,7 +194,7 @@
 	catsCombo->setEditable(true);
 }
 
-void satdialog::setupPageSize(int w, int h)
+void SATDialog::setupPageSize(int w, int h)
 {
 	QString sizelist[] = 
 		{"2380x3368", "1684x2380", "1190x1684", "842x1190", "595x842", "421x595", "297x421", "210x297", "148x210",
@@ -240,7 +240,7 @@
 	psizeEdit->setText(psize + orient);
 }
 
-satdialog::~satdialog()
+SATDialog::~SATDialog()
 {
 	writePrefs();
 }

Modified: trunk/Scribus/scribus/plugins/saveastemplateplugin/satdialog.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17578&path=/trunk/Scribus/scribus/plugins/saveastemplateplugin/satdialog.h
==============================================================================
--- trunk/Scribus/scribus/plugins/saveastemplateplugin/satdialog.h (original)
+++ trunk/Scribus/scribus/plugins/saveastemplateplugin/satdialog.h Sun Jun 17 18:38:39 2012
@@ -14,13 +14,13 @@
 #include <QMap>
 #include <prefscontext.h>
 
-class satdialog : public QDialog, public Ui::satdialog
+class SATDialog : public QDialog, public Ui::SATDialogBase
 {
 	Q_OBJECT
 
 public:
-	satdialog(QWidget* parent, QString tmplName = "", int pageW = 0, int pageH = 0);
-	~satdialog();
+	SATDialog(QWidget* parent, QString tmplName = "", int pageW = 0, int pageH = 0);
+	~SATDialog();
 
 	QMap<QString, QString> cats;
 private slots:

Modified: trunk/Scribus/scribus/plugins/saveastemplateplugin/satdialog.ui
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17578&path=/trunk/Scribus/scribus/plugins/saveastemplateplugin/satdialog.ui
==============================================================================
--- trunk/Scribus/scribus/plugins/saveastemplateplugin/satdialog.ui (original)
+++ trunk/Scribus/scribus/plugins/saveastemplateplugin/satdialog.ui Sun Jun 17 18:38:39 2012
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <ui version="4.0">
- <class>satdialog</class>
- <widget class="QDialog" name="satdialog">
+ <class>SATDialogBase</class>
+ <widget class="QDialog" name="SATDialogBase">
   <property name="geometry">
    <rect>
     <x>0</x>
@@ -17,7 +17,7 @@
    <item row="0" column="0">
     <widget class="QLabel" name="label">
      <property name="text">
-      <string>Name</string>
+      <string>Name:</string>
      </property>
     </widget>
    </item>
@@ -41,7 +41,7 @@
    <item row="2" column="0">
     <widget class="QLabel" name="catsLabel">
      <property name="text">
-      <string>Category</string>
+      <string>Category:</string>
      </property>
     </widget>
    </item>
@@ -55,7 +55,7 @@
    <item row="3" column="0">
     <widget class="QLabel" name="psizeLabel">
      <property name="text">
-      <string>Page Size</string>
+      <string>Page Size:</string>
      </property>
     </widget>
    </item>
@@ -69,7 +69,7 @@
    <item row="4" column="0">
     <widget class="QLabel" name="colorsLabel">
      <property name="text">
-      <string>Colors</string>
+      <string>Colors:</string>
      </property>
     </widget>
    </item>
@@ -83,7 +83,7 @@
    <item row="5" column="0">
     <widget class="QLabel" name="descrLabel">
      <property name="text">
-      <string>Description</string>
+      <string>Description:</string>
      </property>
     </widget>
    </item>
@@ -103,7 +103,7 @@
    <item row="6" column="0">
     <widget class="QLabel" name="usageLabel">
      <property name="text">
-      <string>Usage</string>
+      <string>Usage:</string>
      </property>
     </widget>
    </item>
@@ -123,7 +123,7 @@
    <item row="7" column="0">
     <widget class="QLabel" name="authorLabel">
      <property name="text">
-      <string>Author</string>
+      <string>Author:</string>
      </property>
     </widget>
    </item>
@@ -137,7 +137,7 @@
    <item row="8" column="0">
     <widget class="QLabel" name="emailLabel">
      <property name="text">
-      <string>Email</string>
+      <string>Email:</string>
      </property>
     </widget>
    </item>
@@ -165,7 +165,7 @@
   <connection>
    <sender>buttonBox</sender>
    <signal>accepted()</signal>
-   <receiver>satdialog</receiver>
+   <receiver>SATDialogBase</receiver>
    <slot>accept()</slot>
    <hints>
     <hint type="sourcelabel">
@@ -181,7 +181,7 @@
   <connection>
    <sender>buttonBox</sender>
    <signal>rejected()</signal>
-   <receiver>satdialog</receiver>
+   <receiver>SATDialogBase</receiver>
    <slot>reject()</slot>
    <hints>
     <hint type="sourcelabel">

Modified: trunk/Scribus/scribus/plugins/saveastemplateplugin/satemplate.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17578&path=/trunk/Scribus/scribus/plugins/saveastemplateplugin/satemplate.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/saveastemplateplugin/satemplate.cpp (original)
+++ trunk/Scribus/scribus/plugins/saveastemplateplugin/satemplate.cpp Sun Jun 17 18:38:39 2012
@@ -145,7 +145,7 @@
 
 	if (currentFile !=  doc->DocName)
 	{
-		satdialog* satdia = new satdialog(doc->scMW(),docName,
+		SATDialog* satdia = new SATDialog(doc->scMW(),docName,
 										  static_cast<int>(doc->pageWidth() + 0.5),
 										  static_cast<int>(doc->pageHeight() + 0.5));
 		if (satdia->exec())
@@ -171,7 +171,7 @@
 
 // --------------------- CLASS sat ------------------------------------------------//
 
-sat::sat(ScribusDoc* doc, satdialog* satdia, QString fileName, QString tmplDir)
+sat::sat(ScribusDoc* doc, SATDialog* satdia, QString fileName, QString tmplDir)
 {
 	lang = ScCore->getGuiLanguage();
 	m_Doc = doc;

Modified: trunk/Scribus/scribus/plugins/saveastemplateplugin/satemplate.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17578&path=/trunk/Scribus/scribus/plugins/saveastemplateplugin/satemplate.h
==============================================================================
--- trunk/Scribus/scribus/plugins/saveastemplateplugin/satemplate.h (original)
+++ trunk/Scribus/scribus/plugins/saveastemplateplugin/satemplate.h Sun Jun 17 18:38:39 2012
@@ -35,7 +35,7 @@
 extern "C" PLUGIN_API void saveastemplateplugin_freePlugin(ScPlugin* plugin);
 
 
-class satdialog;
+class SATDialog;
 
 
 class MenuSAT : public QObject
@@ -56,7 +56,7 @@
 {
 private:
 	ScribusDoc* m_Doc;
-	satdialog* dia;
+	SATDialog* dia;
 	QString file;
 	QString dir;
 	QString tmplXmlFile;
@@ -68,7 +68,7 @@
 public:
 	void createTmplXml();
 	void createImages();
-	sat(ScribusDoc* doc, satdialog* satdia, QString fileName, QString tmplDir);
+	sat(ScribusDoc* doc, SATDialog* satdia, QString fileName, QString tmplDir);
 	~sat();
 };
 

Modified: trunk/Scribus/scribus/ui/copypagetomasterpagedialog.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17578&path=/trunk/Scribus/scribus/ui/copypagetomasterpagedialog.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/copypagetomasterpagedialog.cpp (original)
+++ trunk/Scribus/scribus/ui/copypagetomasterpagedialog.cpp Sun Jun 17 18:38:39 2012
@@ -5,22 +5,34 @@
 for which a new license (GPL+exception) is in place.
 */
 
+#include <QAbstractButton>
 #include <QCheckBox>
 #include <QLineEdit>
-
+#include "commonstrings.h"
 #include "copypagetomasterpagedialog.h"
 
 CopyPageToMasterPageDialog::CopyPageToMasterPageDialog(int existingMasterNamesCount, const QStringList& pageLocations, int currentLocation, QWidget *parent)
  : QDialog(parent)
 {
 	setupUi(this);
-	
+
+	QList<QAbstractButton *> buttonList = buttonBox->buttons();
+	foreach (QAbstractButton* b, buttonList)
+	{
+		if (buttonBox->buttonRole(b)==QDialogButtonBox::AcceptRole)
+			b->setText(CommonStrings::tr_OK);
+		else
+		if (buttonBox->buttonRole(b)==QDialogButtonBox::RejectRole)
+			b->setText(CommonStrings::tr_Cancel);
+	}
+
 	nameLineEdit->setText( tr("New Master Page %1").arg(existingMasterNamesCount));
 	if (currentLocation==-1)
 		pagePositionComboBox->hide();
 	else
 	{
-		pagePositionComboBox->addItems(pageLocations);
+		foreach (QString untranslatedPageName, pageLocations)
+			pagePositionComboBox->addItem(CommonStrings::translatePageSetLocString(untranslatedPageName));
 		pagePositionComboBox->setCurrentIndex(currentLocation);
 	}
 }




More information about the scribus-commit mailing list