r19618 by jghali - #12802: Master pages are wrongly managed between UI languages
scribus-commit
scribus-commit at lists.scribus.net
Sun Nov 2 11:12:52 UTC 2014
Author: jghali
Date: Sun Nov 2 11:12:51 2014
New Revision: 19618
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19618
Log:
#12802: Master pages are wrongly managed between UI languages
Modified:
trunk/Scribus/scribus/ui/applytemplatedialog.cpp
trunk/Scribus/scribus/ui/inspage.cpp
trunk/Scribus/scribus/ui/pagepalette_pages.cpp
trunk/Scribus/scribus/ui/pagepalette_widgets.cpp
Modified: trunk/Scribus/scribus/ui/applytemplatedialog.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19618&path=/trunk/Scribus/scribus/ui/applytemplatedialog.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/applytemplatedialog.cpp (original)
+++ trunk/Scribus/scribus/ui/applytemplatedialog.cpp Sun Nov 2 11:12:51 2014
@@ -155,23 +155,23 @@
// no need to delete child widgets, Qt does it all for us
}
-void ApplyMasterPageDialog::setup(ScribusDoc *view, QString Nam)
+void ApplyMasterPageDialog::setup(ScribusDoc *doc, QString Nam)
{
QString na = Nam == CommonStrings::masterPageNormal ? CommonStrings::trMasterPageNormal : Nam, in;
int cc = 0;
- for (QMap<QString,int>::Iterator it = view->MasterNames.begin(); it != view->MasterNames.end(); ++it)
+ for (QMap<QString,int>::Iterator it = doc->MasterNames.begin(); it != doc->MasterNames.end(); ++it)
{
in = it.key() == CommonStrings::masterPageNormal ? CommonStrings::trMasterPageNormal : it.key();
- masterPageComboBox->addItem(in);
+ masterPageComboBox->addItem(in, it.key());
if (in == na)
masterPageComboBox->setCurrentIndex(cc);
++cc;
}
- const unsigned int docPagesCount = view->Pages->count();
+ const unsigned int docPagesCount = doc->Pages->count();
if (docPagesCount < 2)
evenPagesRadioButton->setEnabled(false);
fromPageSpinBox->setMaximum(docPagesCount);
- fromPageSpinBox->setValue(view->currentPage()->pageNr()+1);
+ fromPageSpinBox->setValue(doc->currentPage()->pageNr()+1);
toPageSpinBox->setMaximum(docPagesCount);
toPageSpinBox->setValue(static_cast<int>(docPagesCount));
}
@@ -179,7 +179,8 @@
QString ApplyMasterPageDialog::getMasterPageName()
{
- return masterPageComboBox->currentText();
+ int currentIndex = masterPageComboBox->currentIndex();
+ return masterPageComboBox->itemData(currentIndex).toString();
}
Modified: trunk/Scribus/scribus/ui/inspage.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19618&path=/trunk/Scribus/scribus/ui/inspage.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/inspage.cpp (original)
+++ trunk/Scribus/scribus/ui/inspage.cpp Sun Nov 2 11:12:51 2014
@@ -74,7 +74,9 @@
{
QComboBox* pageData = new QComboBox(masterPageGroup);
for (QMap<QString,int>::Iterator it = currentDoc->MasterNames.begin(); it != currentDoc->MasterNames.end(); ++it)
- pageData->addItem(it.key() == CommonStrings::masterPageNormal ? CommonStrings::trMasterPageNormal : it.key());
+ {
+ pageData->addItem(it.key() == CommonStrings::masterPageNormal ? CommonStrings::trMasterPageNormal : it.key(), it.key());
+ }
if (currentDoc->MasterNames.contains( CommonStrings::trMasterPageNormal))
setCurrentComboItem(pageData, CommonStrings::trMasterPageNormal);
masterPageLabel = new QLabel(tr("&Master Page:"), masterPageGroup);
@@ -97,13 +99,13 @@
for (QMap<QString,int>::Iterator it = currentDoc->MasterNames.begin(); it != currentDoc->MasterNames.end(); ++it)
{
if ((it.key() == CommonStrings::masterPageNormal) && (!conNam))
- pageData->addItem(CommonStrings::trMasterPageNormal);
+ pageData->addItem(CommonStrings::trMasterPageNormal, it.key());
else if ((it.key() == CommonStrings::trMasterPageNormal) && (!conNam))
- pageData->addItem(CommonStrings::trMasterPageNormal);
+ pageData->addItem(CommonStrings::trMasterPageNormal, it.key());
else
{
if (currentDoc->MasterPages.at(it.value())->LeftPg == 1)
- pageData->addItem(it.key());
+ pageData->addItem(it.key(), it.key());
}
}
if (currentDoc->MasterNames.contains( CommonStrings::trMasterPageNormalLeft))
@@ -117,13 +119,13 @@
for (QMap<QString,int>::Iterator it = currentDoc->MasterNames.begin(); it != currentDoc->MasterNames.end(); ++it)
{
if ((it.key() == CommonStrings::masterPageNormal) && (!conNam))
- pageData->addItem(CommonStrings::trMasterPageNormal);
+ pageData->addItem(CommonStrings::trMasterPageNormal, it.key());
else if ((it.key() == CommonStrings::trMasterPageNormal) && (!conNam))
- pageData->addItem(CommonStrings::trMasterPageNormal);
+ pageData->addItem(CommonStrings::trMasterPageNormal, it.key());
else
{
if ((currentDoc->MasterPages.at(it.value())->LeftPg != 0) && (currentDoc->MasterPages.at(it.value())->LeftPg != 1))
- pageData->addItem(it.key());
+ pageData->addItem(it.key(), it.key());
}
}
if (currentDoc->MasterNames.contains( CommonStrings::trMasterPageNormalMiddle))
@@ -135,13 +137,13 @@
for (QMap<QString,int>::Iterator it = currentDoc->MasterNames.begin(); it != currentDoc->MasterNames.end(); ++it)
{
if ((it.key() == CommonStrings::masterPageNormal) && (!conNam))
- pageData->addItem(CommonStrings::trMasterPageNormal);
+ pageData->addItem(CommonStrings::trMasterPageNormal, it.key());
else if ((it.key() == CommonStrings::trMasterPageNormal) && (!conNam))
- pageData->addItem(CommonStrings::trMasterPageNormal);
+ pageData->addItem(CommonStrings::trMasterPageNormal, it.key());
else
{
if (currentDoc->MasterPages.at(it.value())->LeftPg == 0)
- pageData->addItem(it.key());
+ pageData->addItem(it.key(), it.key());
}
}
if (currentDoc->MasterNames.contains( CommonStrings::trMasterPageNormalRight))
@@ -156,13 +158,13 @@
for (QMap<QString,int>::Iterator it = currentDoc->MasterNames.begin(); it != currentDoc->MasterNames.end(); ++it)
{
if ((it.key() == CommonStrings::masterPageNormal) && (!conNam))
- pageData->addItem(CommonStrings::trMasterPageNormal);
+ pageData->addItem(CommonStrings::trMasterPageNormal, it.key());
else if ((it.key() == CommonStrings::trMasterPageNormal) && (!conNam))
- pageData->addItem(CommonStrings::trMasterPageNormal);
+ pageData->addItem(CommonStrings::trMasterPageNormal, it.key());
else
{
if ((currentDoc->MasterPages.at(it.value())->LeftPg != 0) && (currentDoc->MasterPages.at(it.value())->LeftPg != 1))
- pageData->addItem(it.key());
+ pageData->addItem(it.key(), it.key());
}
}
if (currentDoc->MasterNames.contains( CommonStrings::trMasterPageNormalMiddle))
@@ -174,13 +176,13 @@
for (QMap<QString,int>::Iterator it = currentDoc->MasterNames.begin(); it != currentDoc->MasterNames.end(); ++it)
{
if ((it.key() == CommonStrings::masterPageNormal) && (!conNam))
- pageData->addItem(CommonStrings::trMasterPageNormal);
+ pageData->addItem(CommonStrings::trMasterPageNormal, it.key());
else if ((it.key() == CommonStrings::trMasterPageNormal) && (!conNam))
- pageData->addItem(CommonStrings::trMasterPageNormal);
+ pageData->addItem(CommonStrings::trMasterPageNormal, it.key());
else
{
if (currentDoc->MasterPages.at(it.value())->LeftPg == 0)
- pageData->addItem(it.key());
+ pageData->addItem(it.key(), it.key());
}
}
if (currentDoc->MasterNames.contains( CommonStrings::trMasterPageNormalRight))
@@ -193,13 +195,13 @@
for (QMap<QString,int>::Iterator it = currentDoc->MasterNames.begin(); it != currentDoc->MasterNames.end(); ++it)
{
if ((it.key() == CommonStrings::masterPageNormal) && (!conNam))
- pageData->addItem(CommonStrings::trMasterPageNormal);
+ pageData->addItem(CommonStrings::trMasterPageNormal, it.key());
else if ((it.key() == CommonStrings::trMasterPageNormal) && (!conNam))
- pageData->addItem(CommonStrings::trMasterPageNormal);
+ pageData->addItem(CommonStrings::trMasterPageNormal, it.key());
else
{
if (currentDoc->MasterPages.at(it.value())->LeftPg == 0)
- pageData->addItem(it.key());
+ pageData->addItem(it.key(), it.key());
}
}
if (currentDoc->MasterNames.contains( CommonStrings::trMasterPageNormalRight))
@@ -344,14 +346,18 @@
QStringList ret;
for (int n = 0; n < masterPageCombos.count(); ++n)
{
- ret.append(masterPageCombos.at(n)->currentText());
+ int currentIndex = masterPageCombos.at(n)->currentIndex();
+ QVariant pageVar = masterPageCombos.at(n)->itemData(currentIndex);
+ ret.append(pageVar.toString());
}
return ret;
}
const QString InsPage::getMasterPageN(uint n)
{
- return masterPageCombos.at(n)->currentText();
+ QComboBox* comboBox = masterPageCombos.at(n);
+ int currentIndex = comboBox->currentIndex();
+ return comboBox->itemData(currentIndex).toString();
}
int InsPage::getWhere() const
Modified: trunk/Scribus/scribus/ui/pagepalette_pages.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19618&path=/trunk/Scribus/scribus/ui/pagepalette_pages.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/pagepalette_pages.cpp (original)
+++ trunk/Scribus/scribus/ui/pagepalette_pages.cpp Sun Nov 2 11:12:51 2014
@@ -199,16 +199,20 @@
if (currView == 0)
return;
QPixmap pm;
+ QListWidgetItem* item;
QMap<QString,int>::Iterator it;
for (it = currView->Doc->MasterNames.begin(); it != currView->Doc->MasterNames.end(); ++it)
{
+ QString pageLabel = it.key() == CommonStrings::masterPageNormal ? CommonStrings::trMasterPageNormal : it.key();
+ QString pageName = it.key();
if (masterPageList->Thumb)
{
pm = QPixmap::fromImage(currView->MPageToPixmap(it.key(),60));
- new QListWidgetItem(QIcon(pm), it.key() == CommonStrings::masterPageNormal ? CommonStrings::trMasterPageNormal : it.key(), masterPageList);
+ item = new QListWidgetItem(QIcon(pm), pageLabel, masterPageList);
}
else
- masterPageList->addItem(it.key() == CommonStrings::masterPageNormal ? CommonStrings::trMasterPageNormal : it.key());
+ item = new QListWidgetItem(pageLabel, masterPageList);
+ item->setData(Qt::UserRole, pageName);
}
}
@@ -350,7 +354,10 @@
void PagePalette_Pages::selMasterPage()
{
if (masterPageList->CurItem != 0)
- emit gotoMasterPage(masterPageList->CurItem->text());
+ {
+ QVariant pageVar = masterPageList->CurItem->data(Qt::UserRole);
+ emit gotoMasterPage(pageVar.toString());
+ }
}
QPixmap PagePalette_Pages::createIcon(int nr, QString masterPage, QPixmap pixin)
Modified: trunk/Scribus/scribus/ui/pagepalette_widgets.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19618&path=/trunk/Scribus/scribus/ui/pagepalette_widgets.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/pagepalette_widgets.cpp (original)
+++ trunk/Scribus/scribus/ui/pagepalette_widgets.cpp Sun Nov 2 11:12:51 2014
@@ -90,21 +90,21 @@
if ((Mpressed) && ((Mpos - e->pos()).manhattanLength() > 4))
{
Mpressed = false;
- QListWidgetItem *i = itemAt(Mpos);
- if (i)
- {
- QMimeData *mimeData = new QMimeData;
- mimeData->setData("page/magic", "1"+i->text().toLocal8Bit());
- mimeData->setText("1"+i->text());
- QDrag *dr = new QDrag(this);
- dr->setMimeData(mimeData);
- const QPixmap& pm = loadIcon("doc.png");
- dr->setPixmap(pm);
- // dr->setDragCursor(pm, Qt::CopyAction);
- // dr->setDragCursor(pm, Qt::MoveAction);
- dr->exec(Qt::CopyAction | Qt::MoveAction);
- QApplication::setOverrideCursor(Qt::ArrowCursor);
- }
+ QListWidgetItem *item = itemAt(Mpos);
+ if (!item)
+ return;
+ QMimeData *mimeData = new QMimeData;
+ QString pageName = item->data(Qt::UserRole).toString();
+ mimeData->setData("page/magic", "1" + pageName.toLocal8Bit());
+ mimeData->setText("1" + pageName);
+ QDrag *dr = new QDrag(this);
+ dr->setMimeData(mimeData);
+ const QPixmap& pm = loadIcon("doc.png");
+ dr->setPixmap(pm);
+ // dr->setDragCursor(pm, Qt::CopyAction);
+ // dr->setDragCursor(pm, Qt::MoveAction);
+ dr->exec(Qt::CopyAction | Qt::MoveAction);
+ QApplication::setOverrideCursor(Qt::ArrowCursor);
}
}
More information about the scribus-commit
mailing list