aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArmin Berres <armin.berres@basyskom.de>2010-11-16 14:08:24 +0100
committerArmin Berres <armin.berres@basyskom.de>2010-11-16 16:47:36 +0100
commit017698cb4cd13f5faabe974430d681086c387f19 (patch)
treef9707a29a40c8f272601f0878fbb9e8a978ad2e0
parent414a7a6a0ecb80daac04d25315a8b14cf1484275 (diff)
Changes: remove unused code
RevBy: TrustMe Details: We always have to update the code paths but they are not used anywhere.
-rw-r--r--src/corelib/style/mstylesheetattribute.cpp494
-rw-r--r--src/corelib/style/mstylesheetattribute.h9
2 files changed, 0 insertions, 503 deletions
diff --git a/src/corelib/style/mstylesheetattribute.cpp b/src/corelib/style/mstylesheetattribute.cpp
index c16259fe..fdc781ce 100644
--- a/src/corelib/style/mstylesheetattribute.cpp
+++ b/src/corelib/style/mstylesheetattribute.cpp
@@ -788,497 +788,3 @@ bool MStyleSheetAttribute::writeAttribute(const QString &filename,
MStyleSheetParser::outputParseError(filename, "Not a valid attribute(" + QLatin1String(attributeType) + "): " + name + ": " + value, MStyleSheetParser::getLineNum(filename, position));
return false;
}
-
-bool MStyleSheetAttribute::writeAttributeShm(MStyle *style,
- QMetaProperty property,
- MSharedData &ds,
- M::Orientation orientation)
-{
- int containerType;
- bool conversionOK = false;
-
- ds >> containerType;
-
- if (containerType == REAL_TYPE) {
- qreal tmp;
- ds >> tmp;
- return property.write(style, tmp);
-
- } else if (containerType == CONST_PIXMAP_TYPE_0) {
- return property.write(style, qVariantFromValue((const QPixmap *) NULL));
-
- } else if (containerType == CONST_PIXMAP_TYPE_1) {
- QByteArray name;
- ds >> name;
-
- const QPixmap *pixmap = MTheme::pixmap(name);
- return property.write(style, qVariantFromValue(pixmap));
-
- } else if (containerType == CONST_PIXMAP_TYPE_3) {
- QByteArray name;
- int width, height;
- ds >> name >> width >> height;
-
- const QPixmap *pixmap = MTheme::pixmap(name, QSize(width, height));
- return property.write(style, qVariantFromValue(pixmap));
-
- } else if (containerType == CONST_SCALABLE_TYPE_0) {
- property.write(style, qVariantFromValue((const MScalableImage *) NULL));
-
- } else if (containerType == CONST_SCALABLE_TYPE_1) {
- QByteArray name;
- ds >> name;
- const MScalableImage *image = MTheme::scalableImage(name, 0, 0, 0, 0);
- return property.write(style, qVariantFromValue(image));
-
- } else if (containerType == CONST_SCALABLE_TYPE_5) {
- QByteArray name;
- int left, right, top, bottom;
- ds >> name >> left >> right >> top >> bottom;
-
- const MScalableImage *image = MTheme::scalableImage(name, left, right, top, bottom);
- return property.write(style, qVariantFromValue(image));
-
- } else if (containerType == FONT_TYPE) {
- QFont font;
- ds >> font;
- return property.write(style, font);
-
- } else if (containerType == FEEDBACK_TYPE) {
- QByteArray feedbackName;
- ds >> feedbackName;
- MFeedback feedback(feedbackName);
- return property.write(style, qVariantFromValue(feedback));
-
- } else if (containerType == ALIGNMENT_TYPE ||
- containerType == ORIENTATION_TYPE ||
- containerType == UNDERLINESTYLE_TYPE ||
- containerType == PENSTYLE_TYPE ||
- containerType == AXIS_TYPE) {
- int value;
- ds >> value;
- return property.write(style, value);
-
- } else if (containerType == SIZE_TYPE) {
- QByteArray widthStr, heightStr;
- ds >> widthStr >> heightStr;
-
- int width = MStyleSheetAttribute::attributeToInt(widthStr, &conversionOK, WidthAttribute, orientation);
- int height = MStyleSheetAttribute::attributeToInt(heightStr, &conversionOK, HeightAttribute, orientation);
- return property.write(style, QSize(width, height));
-
- } else if (containerType == SIZEF_TYPE) {
- QByteArray widthStr, heightStr;
- ds >> widthStr >> heightStr;
-
- qreal width = MStyleSheetAttribute::attributeToFloat(widthStr, &conversionOK, WidthAttribute, orientation);
- qreal height = MStyleSheetAttribute::attributeToFloat(heightStr, &conversionOK, HeightAttribute, orientation);
-
- return property.write(style, QSizeF(width, height));
-
- } else if (containerType == BOOL_TYPE ||
- containerType == INT_TYPE ||
- containerType == COLOR_TYPE ||
- containerType == POINT_TYPE ||
- containerType == POINTF_TYPE ||
- containerType == STRING_TYPE) {
- QVariant tmp;
- ds >> tmp;
-
- return property.write(style, tmp);
- }
-
-#if QT_VERSION >= 0x040600
- else if (containerType == EASINGCURVE_TYPE) {
- QVariant tmp;
- ds >> tmp;
- return property.write(style, tmp);
- }
-#else
- else {
- // This attribute type is supported in Qt4.6->
- return true;
- }
-#endif
- return false;
-}
-
-void MStyleSheetAttribute::writeAttribute(const QMetaProperty &property,
- MSharedData &shm,
- QByteArray filename)
-{
- bool conversionOK = false;
-
- const char *attributeType = property.typeName();
-
- if (attributeType == types[BOOL_TYPE]) {
- if (qstricmp(value, "true") == 0) {
- shm << (int)BOOL_TYPE << qVariantFromValue(true);
- } else if (qstricmp("false", value) == 0) {
- shm << (int)BOOL_TYPE << qVariantFromValue(false);
- }
- } else if (attributeType == types[INT_TYPE]) {
- int integer = MStyleSheetAttribute::attributeToInt(value, &conversionOK);
- if (conversionOK)
- shm << (int)INT_TYPE << qVariantFromValue(integer);
- } else if (attributeType == types[COLOR_TYPE]) {
- if (value.length() > 0) {
- QColor color(value.data());
- if (color.isValid())
- shm << (int)COLOR_TYPE << qVariantFromValue(color);
- } else
- shm << (int)COLOR_TYPE << qVariantFromValue(QColor());
- } else if (attributeType == types[REAL_TYPE]) {
- qreal real = MStyleSheetAttribute::attributeToFloat(value, &conversionOK);
-
- if (conversionOK)
- shm << (int)REAL_TYPE << real;
- } else if (attributeType == types[CONST_PIXMAP_TYPE]) {
- if (value.startsWith(values[IMAGE_VALUE])) {
- //"image: image(image_id)"
- //"image: image(image_id, 64px, 64px);"
-
- QByteArray values = value.mid(6, value.length() - 7);
- QList<QByteArray> list = values.split(',');
- list.removeAll("");
- if (list.size() == 3) {
- //since 0.11
- qWarning("DEPRECATED: using \"image\" prefix for pixmap attributes is deprecated. Use following syntax instead:");
- qWarning("%s: %s; => %s: \"%s\" %s %s; //<-- %s:%d", name.trimmed().data(), value.data(), name.trimmed().data(), list[0].trimmed().data(), list[1].trimmed().data(), list[2].trimmed().data(), filename.data(), MStyleSheetParser::getLineNum(filename, position));
-
- // Image with size parameters
- QByteArray name = list[0];
- int width = MStyleSheetAttribute::attributeToInt(list[1], &conversionOK);
- int height = MStyleSheetAttribute::attributeToInt(list[2], &conversionOK);
-
- shm << (int)CONST_PIXMAP_TYPE_3 << name << width << height;
- }
-
- else if (list.size() == 1) {
- //since 0.11
- qWarning("DEPRECATED: using \"image\" prefix for pixmap attributes is deprecated. Use following syntax instead:");
- qWarning("%s: %s; => %s: \"%s\"; //<-- %s:%d", name.trimmed().data(), value.data(), name.trimmed().data(), list[0].trimmed().data(), filename.data(), MStyleSheetParser::getLineNum(filename, position));
-
- // Image without size specified
- QByteArray name = list[0];
- shm << (int)CONST_PIXMAP_TYPE_1 << name;
- }
- } else {
- //"image: image_id;"
- //"image: image_id 64px 64px;"
- //"image: "image id";"
- //"image: "image id" 64px 64px;"
-
- QList<QByteArray> list;
- if (value.startsWith('\"')) {
- //parse name inside quotes
- int idx = value.indexOf('\"', 1);
- if (idx != -1) {
- //get quoted image_id
- QByteArray imageid = value.mid(1, idx - 1);
-
- //split rest of the parameters
- QByteArray values = value.mid(idx + 1).trimmed();
- list = values.split(' ');
- list.removeAll("");
- //insert image_id as first parameter
- list.insert(0, imageid);
- }
- } else {
- //no quotes, just split the parameters
- list = value.split(' ');
- }
-
- //only image_id
- if (list.size() == 1)
- shm << (int)CONST_PIXMAP_TYPE_1 << list[0];
-
- //image_id + width + height
- else if (list.size() == 3) {
- int width = MStyleSheetAttribute::attributeToInt(list[1], &conversionOK);
- int height = MStyleSheetAttribute::attributeToInt(list[2], &conversionOK);
- shm << (int)CONST_PIXMAP_TYPE_3 << list[0] << width << height;
- }
- //no parameters
- else if (list.size() == 0) {
- //init null pixmap which is ok if someone does not want to use it
- shm << (int)CONST_PIXMAP_TYPE_0;
- }
- }
- } else if (attributeType == types[CONST_SCALABLE_TYPE]) {
- if (value.toLower().startsWith(values[SCALABLE_VALUE])) {
- //"background: scalable(image_id, left, right, top, bottom);"
-
- QByteArray values = value.mid(9, value.length() - 10);
- QList<QByteArray> list = values.split(',');
- if (list.size() == 5) {
- QByteArray name = list[0];
- int left = MStyleSheetAttribute::attributeToInt(list[1], &conversionOK);
- int right = MStyleSheetAttribute::attributeToInt(list[2], &conversionOK);
- int top = MStyleSheetAttribute::attributeToInt(list[3], &conversionOK);
- int bottom = MStyleSheetAttribute::attributeToInt(list[4], &conversionOK);
-
- //since 0.11
- qWarning("DEPRECATED: using \"scalable\" prefix for images is deprecated. Use following syntax instead:");
- qWarning("%s: %s; => %s: \"%s\" %s %s %s %s; //<-- %s:%d", name.trimmed().data(), value.data(), name.trimmed().data(), name.trimmed().data(), list[1].trimmed().data(), list[2].trimmed().data(), list[3].trimmed().data(), list[4].trimmed().data(), filename.data(), MStyleSheetParser::getLineNum(filename, position));
- if (left == 0 && right == 0 && top == 0 && bottom == 0)
- qWarning("%s: \"%s\";", name.trimmed().data(), name.trimmed().data());
- shm << (int)CONST_SCALABLE_TYPE_5 << name << left << right << top << bottom;
- } else
- shm << (int)CONST_SCALABLE_TYPE_0;
- } else {
- //"background: image_id left right top bottom;"
- //"background: image_id;"
- //"background: "image id" left right top bottom;"
- //"background: "image id";"
-
- QList<QByteArray> list;
- if (value.startsWith('\"')) {
- //parse name inside quotes
- int idx = value.indexOf('\"', 1);
- if (idx != -1) {
- //get quoted image_id
- QByteArray imageid = value.mid(1, idx - 1);
-
- //split rest of the parameters
- QByteArray values = value.mid(idx + 1).trimmed();
- list = values.split(' ');
- list.removeAll("");
-
- //insert image_id as first parameter
- list.insert(0, imageid);
- }
- }
-
- else {
- //no quotes, just split the parameters
- list = value.split(' ');
- }
-
- //no parameters
- if (value.isEmpty()) {
- //init null image which is ok if someone does not want to use it
- shm << (int)CONST_SCALABLE_TYPE_0;
- }
- //only image_id
- else if (list.size() == 1) {
- shm << (int)CONST_SCALABLE_TYPE_1 << list[0];
- }
- //image_id + border width paramaters
- else if (list.size() == 5) {
- //image_id and the border parameters
-
- QByteArray name = list[0];
- int left = MStyleSheetAttribute::attributeToInt(list[1], &conversionOK);
- int right = MStyleSheetAttribute::attributeToInt(list[2], &conversionOK);
- int top = MStyleSheetAttribute::attributeToInt(list[3], &conversionOK);
- int bottom = MStyleSheetAttribute::attributeToInt(list[4], &conversionOK);
-
- shm << (int)CONST_SCALABLE_TYPE_5 << name << left << right << top << bottom;
- }
- }
- }
-
- else if (attributeType == types[SIZE_TYPE] || attributeType == types[SIZEF_TYPE]) {
- if (value.toLower().startsWith(values[SIZE_VALUE])) {
- //size: size(25px, 25px);
-
- QByteArray values = value.mid(5, value.length() - 6);
- QList<QByteArray> list = values.split(',');
- if (list.size() == 2) {
- //since 0.11
- qWarning("DEPRECATED: using \"size\" prefix for size attributes is deprecated. Use following syntax instead:");
- qWarning("%s: %s; => %s: %s %s; //<-- %s:%d", name.trimmed().data(), value.data(), name.trimmed().data(), list[0].trimmed().data(), list[1].trimmed().data(), filename.data(), MStyleSheetParser::getLineNum(filename, position));
-
- if (attributeType == types[SIZE_TYPE])
- shm << (int)SIZE_TYPE << list[0] << list[1];
- else
- shm << (int)SIZEF_TYPE << list[0] << list[1];
- }
- } else {
- //size: 25px 25px;
-
- //just split into pieces and create QSize or QSizeF depending on the attributeType
- QList<QByteArray> list = value.split(' ');
- list.removeAll("");
- if (list.size() == 2) {
- if (attributeType == types[SIZE_TYPE])
- shm << (int)SIZE_TYPE << list[0] << list[1];
- else
- shm << (int)SIZEF_TYPE << list[0] << list[1];
- }
- }
-
- } else if (attributeType == types[POINT_TYPE] || attributeType == types[POINTF_TYPE]) {
-
- if (value.toLower().startsWith(values[POS_VALUE])) {
- //"point: pos(256px, 123px);"
-
- QByteArray values = value.mid(4, value.length() - 5);
- QList<QByteArray> list = values.split(',');
- if (list.size() == 2) {
- //since 0.11
- qWarning("DEPRECATED: using \"pos\" prefix for position attributes is deprecated. Use following syntax instead:");
- qWarning("%s: %s; => %s: %s %s; //<-- %s:%d", name.trimmed().data(), value.data(), name.trimmed().data(), list[0].trimmed().data(), list[1].trimmed().data(), filename.data(), MStyleSheetParser::getLineNum(filename, position));
- if (attributeType == types[POINT_TYPE]) {
- int x = MStyleSheetAttribute::attributeToInt(list[0], &conversionOK);
- int y = MStyleSheetAttribute::attributeToInt(list[1], &conversionOK);
-
- shm << (int)POINT_TYPE << qVariantFromValue(QPoint(x, y));
- } else {
- qreal x = MStyleSheetAttribute::attributeToFloat(list[0], &conversionOK);
- qreal y = MStyleSheetAttribute::attributeToFloat(list[1], &conversionOK);
-
- shm << (int)POINTF_TYPE << qVariantFromValue(QPointF(x, y));
- }
- }
- } else {
- //"point: 256px 123px;
-
- //just split into pieces and create QPoint or QPointF depending on the attributeType
- QList<QByteArray> list = value.split(' ');
- list.removeAll("");
- if (list.size() == 2) {
- if (attributeType == types[POINT_TYPE]) {
- int width = MStyleSheetAttribute::attributeToInt(list[0], &conversionOK);
- int height = MStyleSheetAttribute::attributeToInt(list[1], &conversionOK);
-
- shm << (int)POINT_TYPE << qVariantFromValue(QPoint(width, height));
- } else {
- qreal width = MStyleSheetAttribute::attributeToFloat(list[0], &conversionOK);
- qreal height = MStyleSheetAttribute::attributeToFloat(list[1], &conversionOK);
-
- shm << (int)POINTF_TYPE << qVariantFromValue(QPointF(width, height));
- }
- }
- }
- } else if (attributeType == types[FONT_TYPE]) {
- if (value.toLower().startsWith(values[FONT_VALUE])) {
- //"font(sans, 10px);"
-
- QByteArray values = value.mid(5, value.length() - 6);
- QList<QByteArray> list = values.split(',');
- if (list.size() == 2) {
- float pixelSize = MStyleSheetAttribute::attributeToFloat(list[1], &conversionOK);
- if (conversionOK) {
- QFont font(list[0]);
- font.setPixelSize(pixelSize);
- //since 0.11
- qWarning("DEPRECATED: using \"font\" prefix for font is deprecated. Use following syntax instead:");
- qWarning("%s: %s; => %s: \"%s\" %s; //<-- %s:%d", name.trimmed().constData(), value.constData(), name.trimmed().data(), list[0].trimmed().data(), list[1].trimmed().data(), filename.data(), MStyleSheetParser::getLineNum(filename, position));
-
- shm << (int)FONT_TYPE << font;
- }
- }
- } else {
- //font: "font family" 20px
- //font: "font family" bold 20px
- //font: font_family 20px
- //font: font_family bold 20px
-
- QList<QByteArray> list;
- if (value.startsWith('\"')) {
- int idx = value.indexOf('\"', 1);
- if (idx != -1) {
- //get quoted font family name
- QByteArray family = value.mid(1, idx - 1);
-
- //split rest of the parameters
- QByteArray values = value.mid(idx + 1).trimmed();
- list = values.split(' ');
- list.removeAll("");
-
- //insert family as first parameter
- list.insert(0, family);
- }
- } else {
- //no quotes, just split the parameters
- list = value.split(' ');
- }
-
- //family + font size
- if (list.size() == 2) {
- float pixelSize = MStyleSheetAttribute::attributeToFloat(list[1], &conversionOK);
- if (conversionOK) {
- QFont font(list[0]);
- font.setPixelSize(pixelSize);
- shm << (int)FONT_TYPE << font;
- }
- }
- //family + weight + font size
- else if (list.size() == 3) {
- float pixelSize = MStyleSheetAttribute::attributeToFloat(list[2], &conversionOK);
- if (conversionOK) {
- QFont font(list[0]);
- font.setPixelSize(pixelSize);
- if (DataTypeConverter.WEIGHTS.contains(list[1]))
- font.setWeight(DataTypeConverter.WEIGHTS[list[1]]);
-
- shm << (int)FONT_TYPE << font;
- }
- }
- }
- } else if (attributeType == types[STRING_TYPE]) {
- if (value.length() >= 2) {
- if ((value.at(0) == 0x22) && (value.at(value.length()-1) == 0x22)) {
- QByteArray tmp = value.mid(1, value.length() - 2);
- shm << (int)STRING_TYPE << qVariantFromValue(tmp);
- }
- } else if (value.length() == 0)
- shm << (int)STRING_TYPE << qVariantFromValue(QString());
- }
-
- else if (attributeType == types[ALIGNMENT_TYPE]) {
- if (DataTypeConverter.ALIGNMENTS.contains(value))
- shm << (int)ALIGNMENT_TYPE << (int)(DataTypeConverter.ALIGNMENTS[value]);
- } else if (attributeType == types[ORIENTATION_TYPE]) {
- if (DataTypeConverter.ORIENTATIONS.contains(value))
- shm << (int)ORIENTATION_TYPE << (int)(DataTypeConverter.ORIENTATIONS[value]);
- } else if (attributeType == types[UNDERLINESTYLE_TYPE]) {
- if (DataTypeConverter.UNDERLINESTYLES.contains(value))
- shm << (int)UNDERLINESTYLE_TYPE << (int)(DataTypeConverter.UNDERLINESTYLES[value]);
- } else if (attributeType == types[PENSTYLE_TYPE]) {
- if (DataTypeConverter.PENSTYLES.contains(value))
- shm << (int)PENSTYLE_TYPE << (int)(DataTypeConverter.PENSTYLES[value]);
- } else if (attributeType == types[AXIS_TYPE]) {
- if (DataTypeConverter.AXES.contains(value))
- shm << (int)AXIS_TYPE << (int)(DataTypeConverter.AXES[value]);
- } else if (attributeType == types[FEEDBACK_TYPE])
- shm << (int)FEEDBACK_TYPE << value;
-
-#if QT_VERSION >= 0x040600
- else if (attributeType == types[EASINGCURVE_TYPE]) {
- QEasingCurve curve;
- // curve type
- QList<QByteArray> list = value.split(',');
- if (list.size() > 0) {
- if (DataTypeConverter.EASINGCURVETYPES.contains(list[0])) {
- curve.setType(DataTypeConverter.EASINGCURVETYPES[list[0]]);
- // curve amplitude
- if (list.size() > 1) {
- curve.setAmplitude((qreal) list[1].toDouble());
- // curve overshoot
- if (list.size() > 2) {
- curve.setOvershoot((qreal) list[2].toDouble());
- // curve period
- if (list.size() > 3) {
- curve.setPeriod((qreal) list[3].toDouble());
- }
- }
- }
-
- shm << (int)EASINGCURVE_TYPE << qVariantFromValue(curve);
- }
- }
- } else {
- MStyleSheetParser::outputParseError(filename, "Not a valid attribute(" + QLatin1String(attributeType) + "): " + name + ": " + value, MStyleSheetParser::getLineNum(filename, position));
- }
-#else
- else {
- // This attribute type is supported in Qt4.6->
- shm << (int)NUM_TYPES;
- }
-#endif
-
-}
-
diff --git a/src/corelib/style/mstylesheetattribute.h b/src/corelib/style/mstylesheetattribute.h
index db3528a7..67551f2f 100644
--- a/src/corelib/style/mstylesheetattribute.h
+++ b/src/corelib/style/mstylesheetattribute.h
@@ -64,15 +64,6 @@ public:
MStyle *style,
const QMetaProperty &property,
M::Orientation orientation);
-
- void writeAttribute(const QMetaProperty &property,
- MSharedData &shm,
- QByteArray filename);
-
- bool writeAttributeShm(MStyle *style,
- QMetaProperty property,
- MSharedData &ds,
- M::Orientation orientation);
};
typedef QMap<QByteArray, MStyleSheetAttribute *> MAttributeList;