r16860 by jghali - #10174: the return of the brownish color
scribus-commit
scribus-commit at lists.scribus.net
Thu Sep 29 21:52:31 UTC 2011
Author: jghali
Date: Thu Sep 29 21:52:31 2011
New Revision: 16860
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=16860
Log:
#10174: the return of the brownish color
Modified:
branches/Version135/Scribus/scribus/colorcombo.cpp
branches/Version135/Scribus/scribus/colorlistbox.cpp
branches/Version135/Scribus/scribus/colorlistbox.h
branches/Version135/Scribus/scribus/tabtools.cpp
Modified: branches/Version135/Scribus/scribus/colorcombo.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16860&path=/branches/Version135/Scribus/scribus/colorcombo.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/colorcombo.cpp (original)
+++ branches/Version135/Scribus/scribus/colorcombo.cpp Thu Sep 29 21:52:31 2011
@@ -41,10 +41,9 @@
setView( lb );
}
-
QString ColorCombo::currentColor() const
{
- return currentText();
+ return currentText();
}
void ColorCombo::updateBox(ColorList& list, ColorCombo::PixmapType pixType , bool insertNone)
@@ -54,7 +53,10 @@
{
clb->clear();
if ( insertNone )
+ {
clb->addItem(CommonStrings::tr_NoneColor);
+ clb->item(0)->setData(Qt::UserRole, CommonStrings::None);
+ }
if ( pixType == ColorCombo::fancyPixmaps )
clb->insertItems(list, ColorListBox::fancyPixmap);
else if ( pixType == ColorCombo::widePixmaps )
Modified: branches/Version135/Scribus/scribus/colorlistbox.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16860&path=/branches/Version135/Scribus/scribus/colorlistbox.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/colorlistbox.cpp (original)
+++ branches/Version135/Scribus/scribus/colorlistbox.cpp Thu Sep 29 21:52:31 2011
@@ -193,6 +193,30 @@
setItemDelegate(new ColorWideItemDelegate());
}
+void ColorListBox::changeEvent(QEvent *e)
+{
+ if (e->type() == QEvent::LanguageChange)
+ {
+ languageChange();
+ return;
+ }
+ QListWidget::changeEvent(e);
+}
+
+void ColorListBox::languageChange()
+{
+ if (this->count() > 0)
+ {
+ QModelIndexList result;
+ QModelIndex start = model()->index(0, 0, this->rootIndex());
+ result = model()->match(start, Qt::UserRole, CommonStrings::None, 1, Qt::MatchExactly | Qt::MatchCaseSensitive);
+ if (result.isEmpty())
+ return;
+ int index = result.first().row();
+ QListWidgetItem* item = this->item(index);
+ item->setText(CommonStrings::tr_NoneColor);
+ }
+}
QString ColorListBox::currentColor() const
{
@@ -242,6 +266,11 @@
void ColorListBox::addItem(QString text)
{
QListWidget::addItem(text);
+ if (text == CommonStrings::None || text == CommonStrings::tr_NoneColor)
+ {
+ QListWidgetItem* item = this->item(count() - 1);
+ item->setData(Qt::UserRole, CommonStrings::None);
+ }
}
void ColorListBox::insertSmallPixmapItems(ColorList& list)
Modified: branches/Version135/Scribus/scribus/colorlistbox.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16860&path=/branches/Version135/Scribus/scribus/colorlistbox.h
==============================================================================
--- branches/Version135/Scribus/scribus/colorlistbox.h (original)
+++ branches/Version135/Scribus/scribus/colorlistbox.h Thu Sep 29 21:52:31 2011
@@ -81,6 +81,8 @@
Just there are initialized pixmaps for icon drawing. */
ColorListBox(QWidget * parent = 0);
+ virtual void changeEvent(QEvent *e);
+
QString currentColor() const;
/*! \brief Fill the list box with values taken from list.
@@ -116,8 +118,9 @@
ColorList *cList;
protected:
bool event(QEvent *event);
-
- int m_selectedRow;
+
+protected slots:
+ virtual void languageChange();
};
#endif
Modified: branches/Version135/Scribus/scribus/tabtools.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16860&path=/branches/Version135/Scribus/scribus/tabtools.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/tabtools.cpp (original)
+++ branches/Version135/Scribus/scribus/tabtools.cpp Thu Sep 29 21:52:31 2011
@@ -640,60 +640,35 @@
}
}
-
+ int index;
ColorList::Iterator itc, endOfColorList;
ColorList* colorList = (docu != 0) ? (&docu->PageColors) : prefsManager->colorSetPtr();
- colorComboText->clear();
- colorComboText->addItem(CommonStrings::tr_NoneColor);
+ colorComboText->updateBox(*colorList, ColorCombo::fancyPixmaps);
if (prefsData->dPenText == CommonStrings::None)
- colorComboText->setCurrentIndex(colorComboText->count()-1);
- endOfColorList=colorList->end();
- for (itc = colorList->begin(); itc != endOfColorList; ++itc)
- {
- colorComboText->insertFancyItem( itc.value(), docu, itc.key() );
- if (itc.key() == prefsData->dPenText)
- colorComboText->setCurrentIndex(colorComboText->count()-1);
- }
-
+ colorComboText->setCurrentIndex(0);
+ else if((index = colorComboText->findText(prefsData->dPenText)) >= 0)
+ colorComboText->setCurrentIndex(index);
shadingText->setValue(prefsData->dTextPenShade);
- colorComboStrokeText->clear();
- colorComboStrokeText->addItem(CommonStrings::tr_NoneColor);
+ colorComboStrokeText->updateBox(*colorList, ColorCombo::fancyPixmaps);
if (prefsData->dStrokeText == CommonStrings::None)
- colorComboStrokeText->setCurrentIndex(colorComboStrokeText->count()-1);
- endOfColorList=colorList->end();
- for (itc = colorList->begin(); itc != endOfColorList; ++itc)
- {
- colorComboStrokeText->insertFancyItem( itc.value(), docu, itc.key() );
- if (itc.key() == prefsData->dStrokeText)
- colorComboStrokeText->setCurrentIndex(colorComboStrokeText->count()-1);
- }
+ colorComboStrokeText->setCurrentIndex(0);
+ else if((index = colorComboStrokeText->findText(prefsData->dStrokeText)) >= 0)
+ colorComboStrokeText->setCurrentIndex(index);
shadingTextStroke->setValue(prefsData->dTextStrokeShade);
- colorComboTextBackground->clear();
- colorComboTextBackground->addItem(CommonStrings::tr_NoneColor);
+ colorComboTextBackground->updateBox(*colorList, ColorCombo::fancyPixmaps);
if (prefsData->dTextBackGround == CommonStrings::None)
- colorComboTextBackground->setCurrentIndex(colorComboTextBackground->count()-1);
- endOfColorList=colorList->end();
- for (itc = colorList->begin(); itc != endOfColorList; ++itc)
- {
- colorComboTextBackground->insertFancyItem( itc.value(), docu, itc.key() );
- if (itc.key() == prefsData->dTextBackGround)
- colorComboTextBackground->setCurrentIndex(colorComboTextBackground->count()-1);
- }
+ colorComboTextBackground->setCurrentIndex(0);
+ else if((index = colorComboTextBackground->findText(prefsData->dTextBackGround)) >= 0)
+ colorComboTextBackground->setCurrentIndex(index);
shadingTextBack->setValue(prefsData->dTextBackGroundShade);
- colorComboTextLine->clear();
- colorComboTextLine->addItem(CommonStrings::tr_NoneColor);
+ colorComboTextLine->updateBox(*colorList, ColorCombo::fancyPixmaps);
if (prefsData->dTextLineColor == CommonStrings::None)
- colorComboTextLine->setCurrentIndex(colorComboTextLine->count()-1);
- endOfColorList=colorList->end();
- for (itc = colorList->begin(); itc != endOfColorList; ++itc)
- {
- colorComboTextLine->insertFancyItem( itc.value(), docu, itc.key() );
- if (itc.key() == prefsData->dTextLineColor)
- colorComboTextLine->setCurrentIndex(colorComboTextLine->count()-1);
- }
+ colorComboTextLine->setCurrentIndex(0);
+ else if((index = colorComboTextLine->findText(prefsData->dTextLineColor)) >= 0)
+ colorComboTextLine->setCurrentIndex(index);
shadingTextLine->setValue(prefsData->dTextLineShade);
tabFillCombo->clear();
@@ -730,47 +705,28 @@
columnsText->setValue(prefsData->dCols);
gapText->setValue(prefsData->dGap * unitRatio);
- colorComboLineShape->clear();
- colorComboLineShape->addItem(CommonStrings::tr_NoneColor);
+ colorComboLineShape->updateBox(*colorList, ColorCombo::fancyPixmaps);
if (prefsData->dPen == CommonStrings::None)
- colorComboLineShape->setCurrentIndex(colorComboLineShape->count()-1);
- endOfColorList=colorList->end();
- for (itc = colorList->begin(); itc != endOfColorList; ++itc)
- {
- colorComboLineShape->insertFancyItem( itc.value(), docu, itc.key() );
- if (itc.key() == prefsData->dPen)
- colorComboLineShape->setCurrentIndex(colorComboLineShape->count()-1);
- }
+ colorComboLineShape->setCurrentIndex(0);
+ else if((index = colorComboLineShape->findText(prefsData->dPen)) >= 0)
+ colorComboLineShape->setCurrentIndex(index);
shadingLineShape->setValue(prefsData->dShade2);
- comboFillShape->clear();
- comboFillShape->addItem(CommonStrings::tr_NoneColor);
+ comboFillShape->updateBox(*colorList, ColorCombo::fancyPixmaps);
if (prefsData->dBrush == CommonStrings::None)
- comboFillShape->setCurrentIndex(comboFillShape->count()-1);
- endOfColorList=colorList->end();
- for (itc = colorList->begin(); itc != endOfColorList; ++itc)
- {
- comboFillShape->insertFancyItem( itc.value(), docu, itc.key() );
- if (itc.key() == prefsData->dBrush)
- comboFillShape->setCurrentIndex(comboFillShape->count()-1);
- }
-
+ comboFillShape->setCurrentIndex(0);
+ else if((index = comboFillShape->findText(prefsData->dBrush)) >= 0)
+ comboFillShape->setCurrentIndex(index);
shadingFillShape->setValue(prefsData->dShade);
+
comboStyleShape->setCurrentIndex(static_cast<int>(prefsData->dLineArt) - 1);
lineWidthShape->setValue(prefsData->dWidth);
- colorComboLine->clear();
- colorComboLine->addItem(CommonStrings::tr_NoneColor);
+ colorComboLine->updateBox(*colorList, ColorCombo::fancyPixmaps);
if (prefsData->dPenLine == CommonStrings::None)
- colorComboLine->setCurrentIndex(colorComboLine->count()-1);
- endOfColorList=colorList->end();
- for (itc = colorList->begin(); itc != endOfColorList; ++itc)
- {
- colorComboLine->insertFancyItem( itc.value(), docu, itc.key() );
- if (itc.key() == prefsData->dPenLine)
- colorComboLine->setCurrentIndex(colorComboLine->count()-1);
- }
-
+ colorComboLine->setCurrentIndex(0);
+ else if((index = colorComboLine->findText(prefsData->dPenLine)) >= 0)
+ colorComboLine->setCurrentIndex(index);
shadingLine->setValue(prefsData->dShadeLine);
comboStyleLine->setCurrentIndex(static_cast<int>(prefsData->dLstyleLine) - 1);
@@ -794,17 +750,11 @@
buttonGroup5->setChecked( !prefsData->scaleType );
checkRatioImage->setChecked(prefsData->aspectRatio);
- comboFillImage->clear();
- comboFillImage->addItem(CommonStrings::tr_NoneColor);
+ comboFillImage->updateBox(*colorList, ColorCombo::fancyPixmaps);
if (prefsData->dBrushPict == CommonStrings::None)
- comboFillImage->setCurrentIndex(comboFillImage->count()-1);
- endOfColorList=colorList->end();
- for (itc = colorList->begin(); itc != endOfColorList; ++itc)
- {
- comboFillImage->insertFancyItem( itc.value(), docu, itc.key() );
- if (itc.key() == prefsData->dBrushPict)
- comboFillImage->setCurrentIndex(comboFillImage->count()-1);
- }
+ comboFillImage->setCurrentIndex(0);
+ else if((index = comboFillImage->findText(prefsData->dBrushPict)) >= 0)
+ comboFillImage->setCurrentIndex(index);
shadingFillImage->setValue( prefsData->shadePict );
embeddedPath->setChecked(prefsData->useEmbeddedPath);
More information about the scribus-commit
mailing list