r24334 by jghali - Code cleanup
scribus-commit
scribus-commit at lists.scribus.net
Sat Dec 19 02:42:11 UTC 2020
Author: jghali
Date: Sat Dec 19 02:42:11 2020
New Revision: 24334
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24334
Log:
Code cleanup
Modified:
trunk/Scribus/scribus/ui/propertiespalette_line.cpp
trunk/Scribus/scribus/ui/propertiespalette_utils.cpp
trunk/Scribus/scribus/ui/propertiespalette_utils.h
Modified: trunk/Scribus/scribus/ui/propertiespalette_line.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24334&path=/trunk/Scribus/scribus/ui/propertiespalette_line.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/propertiespalette_line.cpp (original)
+++ trunk/Scribus/scribus/ui/propertiespalette_line.cpp Sat Dec 19 02:42:11 2020
@@ -59,7 +59,7 @@
lineJoinLabel->setBuddy(lineJoinStyle);
lineEndLabel->setBuddy(lineEndStyle);
- lineStyles->setItemDelegate(new LineFormatItemDelegate);
+ lineStyles->setItemDelegate(new LineStyleItemDelegate());
lineStyles->addItem( "No Style" );
languageChange();
@@ -365,7 +365,7 @@
{
QHash<QString,multiLine>::Iterator it;
for (it = doc->docLineStyles.begin(); it != doc->docLineStyles.end(); ++it)
- lineStyles->addItem( new LineFormatItem(doc, it.value(), it.key()) );
+ lineStyles->addItem( new LineStyleItem(doc, it.value(), it.key()) );
lineStyles->sortItems();
lineStyles->insertItem( 0, tr("No Style"));
if (lineStyles->currentItem())
Modified: trunk/Scribus/scribus/ui/propertiespalette_utils.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24334&path=/trunk/Scribus/scribus/ui/propertiespalette_utils.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/propertiespalette_utils.cpp (original)
+++ trunk/Scribus/scribus/ui/propertiespalette_utils.cpp Sat Dec 19 02:42:11 2020
@@ -39,22 +39,22 @@
//using namespace std;
-LineFormatValue::LineFormatValue() : m_doc(nullptr), m_name() {};
+LineStyleValue::LineStyleValue() : m_doc(nullptr), m_name() {};
-LineFormatValue::LineFormatValue( const multiLine& line, ScribusDoc* doc, const QString& name ) :
+LineStyleValue::LineStyleValue(const multiLine& line, ScribusDoc* doc, const QString& name) :
m_Line(line),
m_doc(doc),
m_name(name)
{};
-LineFormatValue::LineFormatValue(const LineFormatValue& other)
+LineStyleValue::LineStyleValue(const LineStyleValue& other)
{
m_name = other.m_name;
m_Line = other.m_Line;
m_doc = other.m_doc;
}
-LineFormatValue& LineFormatValue::operator= (const LineFormatValue& other)
+LineStyleValue& LineStyleValue::operator= (const LineStyleValue& other)
{
m_name = other.m_name;
m_Line = other.m_Line;
@@ -63,37 +63,37 @@
}
-void LineFormatItemDelegate::redraw(const QVariant& data) const
+void LineStyleItemDelegate::redraw(const QVariant& data) const
{
- const LineFormatValue& item(data.value<LineFormatValue>());
- QColor tmpf;
+ const LineStyleValue& item(data.value<LineStyleValue>());
pmap->fill(Qt::white);
QPainter p;
p.begin(pmap.data());
- for (int its = item.m_Line.size()-1; its > -1; its--)
+ for (int i = item.m_Line.size() - 1; i > -1; i--)
{
- const ScColor& col = item.m_doc->PageColors[item.m_Line[its].Color];
- tmpf = ScColorEngine::getDisplayColor(col, item.m_doc, item.m_Line[its].Shade);
+ const SingleLine& sLine = item.m_Line.at(i);
+ const ScColor& col = item.m_doc->PageColors[sLine.Color];
+ QColor tmpf = ScColorEngine::getDisplayColor(col, item.m_doc, sLine.Shade);
QPen pen;
QVector<double> m_array;
- if (item.m_Line[its].Dash == 1)
+ if (sLine.Dash == 1)
pen.setStyle(Qt::SolidLine);
else
{
- getDashArray(item.m_Line[its].Dash, 1, m_array);
+ getDashArray(sLine.Dash, 1, m_array);
pen.setDashPattern(m_array);
}
pen.setColor(tmpf);
- pen.setWidth(qMax(static_cast<int>(item.m_Line[its].Width), 1));
- pen.setCapStyle(static_cast<Qt::PenCapStyle>(item.m_Line[its].LineEnd));
- pen.setJoinStyle(static_cast<Qt::PenJoinStyle>(item.m_Line[its].LineJoin));
+ pen.setWidth(qMax(static_cast<int>(sLine.Width), 1));
+ pen.setCapStyle(static_cast<Qt::PenCapStyle>(sLine.LineEnd));
+ pen.setJoinStyle(static_cast<Qt::PenJoinStyle>(sLine.LineJoin));
p.setPen(pen);
p.drawLine(0, 18, 37, 18);
}
p.end();
}
-QString LineFormatItemDelegate::text(const QVariant& data) const
+QString LineStyleItemDelegate::text(const QVariant& data) const
{
return data.toString();
}
Modified: trunk/Scribus/scribus/ui/propertiespalette_utils.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24334&path=/trunk/Scribus/scribus/ui/propertiespalette_utils.h
==============================================================================
--- trunk/Scribus/scribus/ui/propertiespalette_utils.h (original)
+++ trunk/Scribus/scribus/ui/propertiespalette_utils.h Sat Dec 19 02:42:11 2020
@@ -42,49 +42,49 @@
class ScribusDoc;
class ScribusMainWindow;
-struct SCRIBUS_API LineFormatValue
+struct SCRIBUS_API LineStyleValue
{
multiLine m_Line;
ScGuardedPtr<ScribusDoc> m_doc;
QString m_name;
- LineFormatValue();
- LineFormatValue( const multiLine& line, ScribusDoc* doc, const QString& name );
- LineFormatValue(const LineFormatValue& other);
- LineFormatValue& operator= (const LineFormatValue& other);
+ LineStyleValue();
+ LineStyleValue(const multiLine& line, ScribusDoc* doc, const QString& name);
+ LineStyleValue(const LineStyleValue& other);
+ LineStyleValue& operator= (const LineStyleValue& other);
};
-Q_DECLARE_METATYPE(LineFormatValue);
+Q_DECLARE_METATYPE(LineStyleValue);
-class SCRIBUS_API LineFormatItem : public QListWidgetItem
+class SCRIBUS_API LineStyleItem : public QListWidgetItem
{
enum usrType {
- LineFormatUserType = UserType + 2
+ LineStyleUserType = UserType + 2
};
public:
- LineFormatItem( ScribusDoc* doc, const multiLine& line, const QString& name ) : QListWidgetItem(NULL, LineFormatUserType)
+ LineStyleItem( ScribusDoc* doc, const multiLine& line, const QString& name ) : QListWidgetItem(NULL, LineStyleUserType)
{
setText(name);
- setData(Qt::UserRole, QVariant::fromValue(LineFormatValue(line, doc, name)));
+ setData(Qt::UserRole, QVariant::fromValue(LineStyleValue(line, doc, name)));
};
- LineFormatItem( ) : QListWidgetItem(NULL, LineFormatUserType)
+ LineStyleItem( ) : QListWidgetItem(NULL, LineStyleUserType)
{
setText("");
- setData(Qt::UserRole, QVariant::fromValue(LineFormatValue()));
+ setData(Qt::UserRole, QVariant::fromValue(LineStyleValue()));
};
- LineFormatItem * clone () const { return new LineFormatItem(*this); }
+ LineStyleItem * clone () const { return new LineStyleItem(*this); }
};
-class SCRIBUS_API LineFormatItemDelegate : public ScListBoxPixmap<37, 37>
+class SCRIBUS_API LineStyleItemDelegate : public ScListBoxPixmap<37, 37>
{
Q_OBJECT
public:
- LineFormatItemDelegate() : ScListBoxPixmap<37, 37>() {}
+ LineStyleItemDelegate() : ScListBoxPixmap<37, 37>() {}
virtual int rtti() const { return 148523874; }
virtual QString text(const QVariant&) const;
virtual void redraw(const QVariant&) const;
More information about the scribus-commit
mailing list