forked from qt-creator/qt-creator
QmlEditorWidgets: Compile with QT_NO_CAST_FROM_ASCII
Change-Id: I84ed6dca71621a4e790f5aff0ad25339fb9e8772 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
71ce993cdb
commit
1f0f5eabb5
@@ -45,7 +45,12 @@ Q_PROPERTY(bool noColor READ noColor WRITE setNoColor)
|
||||
Q_PROPERTY(bool showArrow READ showArrow WRITE setShowArrow)
|
||||
|
||||
public:
|
||||
ColorButton(QWidget *parent = 0) : QToolButton (parent), m_colorString("#ffffff"), m_noColor(false), m_showArrow(true) {}
|
||||
ColorButton(QWidget *parent = 0) :
|
||||
QToolButton (parent),
|
||||
m_colorString(QLatin1String("#ffffff")),
|
||||
m_noColor(false),
|
||||
m_showArrow(true)
|
||||
{}
|
||||
|
||||
void setColor(const QVariant &colorStr);
|
||||
QVariant color() const { return m_colorString; }
|
||||
|
||||
@@ -95,7 +95,7 @@ ContextPaneTextWidget::ContextPaneTextWidget(QWidget *parent) :
|
||||
|
||||
static inline bool checkIfBoolean(QVariant v)
|
||||
{
|
||||
return (v.toString() == "true" || v.toString() == "false");
|
||||
return (v.toString() == QLatin1String("true") || v.toString() == QLatin1String("false"));
|
||||
}
|
||||
|
||||
void ContextPaneTextWidget::setProperties(QmlJS::PropertyReader *propertyReader)
|
||||
@@ -170,13 +170,13 @@ void ContextPaneTextWidget::setProperties(QmlJS::PropertyReader *propertyReader)
|
||||
}
|
||||
|
||||
if (propertyReader->hasProperty(QLatin1String("color"))) {
|
||||
ui->colorButton->setColor(propertyReader->readProperty("color").toString());
|
||||
ui->colorButton->setColor(propertyReader->readProperty(QLatin1String("color")).toString());
|
||||
} else {
|
||||
ui->colorButton->setColor(QLatin1String("black"));
|
||||
}
|
||||
|
||||
if (propertyReader->hasProperty(QLatin1String("styleColor"))) {
|
||||
ui->textColorButton->setColor(propertyReader->readProperty("styleColor").toString());
|
||||
ui->textColorButton->setColor(propertyReader->readProperty(QLatin1String("styleColor")).toString());
|
||||
} else {
|
||||
ui->textColorButton->setColor(QLatin1String("black"));
|
||||
}
|
||||
@@ -197,7 +197,7 @@ void ContextPaneTextWidget::setProperties(QmlJS::PropertyReader *propertyReader)
|
||||
QString alignment = propertyReader->readProperty(QLatin1String("horizontalAlignment")).toString();
|
||||
ui->leftAlignmentButton->setChecked(true);
|
||||
ui->leftAlignmentButton->setEnabled(true);
|
||||
if (alignment == QLatin1String("Text.AlignHCenter") || alignment == "AlignHCenter")
|
||||
if (alignment == QLatin1String("Text.AlignHCenter") || alignment == QLatin1String("AlignHCenter"))
|
||||
ui->centerHAlignmentButton->setChecked(true);
|
||||
else if (alignment == QLatin1String("Text.AlignRight") || alignment == QLatin1String("AlignRight"))
|
||||
ui->rightAlignmentButton->setChecked(true);
|
||||
@@ -354,7 +354,7 @@ void ContextPaneTextWidget::onStrikeoutCheckedChanged(bool value)
|
||||
void ContextPaneTextWidget::onCurrentFontChanged(const QFont &font)
|
||||
{
|
||||
font.family();
|
||||
emit propertyChanged(QLatin1String("font.family"), QVariant(QString('\"') + font.family() + QString('\"')));
|
||||
emit propertyChanged(QLatin1String("font.family"), QVariant(QLatin1Char('"') + font.family() + QLatin1Char('"')));
|
||||
}
|
||||
|
||||
void ContextPaneTextWidget::onHorizontalAlignmentChanged()
|
||||
|
||||
@@ -343,17 +343,17 @@ bool ContextPaneWidget::setType(const QStringList &types)
|
||||
m_rectangleWidget->hide();
|
||||
m_easingWidget->hide();
|
||||
|
||||
if (types.contains("Text") ||
|
||||
types.contains("TextEdit") ||
|
||||
types.contains("TextInput")) {
|
||||
if (types.contains(QLatin1String("Text")) ||
|
||||
types.contains(QLatin1String("TextEdit")) ||
|
||||
types.contains(QLatin1String("TextInput"))) {
|
||||
m_currentWidget = m_textWidget;
|
||||
m_textWidget->show();
|
||||
m_textWidget->setStyleVisible(true);
|
||||
m_textWidget->setVerticalAlignmentVisible(true);
|
||||
if (types.contains("TextInput")) {
|
||||
if (types.contains(QLatin1String("TextInput"))) {
|
||||
m_textWidget->setVerticalAlignmentVisible(false);
|
||||
m_textWidget->setStyleVisible(false);
|
||||
} else if (types.contains("TextEdit")) {
|
||||
} else if (types.contains(QLatin1String("TextEdit"))) {
|
||||
m_textWidget->setStyleVisible(false);
|
||||
}
|
||||
resize(sizeHint());
|
||||
@@ -366,7 +366,7 @@ bool ContextPaneWidget::setType(const QStringList &types)
|
||||
resize(sizeHint());
|
||||
return true;
|
||||
}
|
||||
if (types.contains("Rectangle")) {
|
||||
if (types.contains(QLatin1String("Rectangle"))) {
|
||||
m_currentWidget = m_rectangleWidget;
|
||||
m_rectangleWidget->enabableGradientEditing(!isPropertyChanges());
|
||||
m_rectangleWidget->show();
|
||||
@@ -374,14 +374,14 @@ bool ContextPaneWidget::setType(const QStringList &types)
|
||||
return true;
|
||||
}
|
||||
|
||||
if (types.contains("BorderImage")) {
|
||||
if (types.contains(QLatin1String("BorderImage"))) {
|
||||
m_currentWidget = m_borderImageWidget;
|
||||
m_borderImageWidget->show();
|
||||
resize(sizeHint());
|
||||
return true;
|
||||
}
|
||||
|
||||
if (types.contains("Image")) {
|
||||
if (types.contains(QLatin1String("Image"))) {
|
||||
m_currentWidget = m_imageWidget;
|
||||
m_imageWidget->show();
|
||||
resize(sizeHint());
|
||||
@@ -392,8 +392,10 @@ bool ContextPaneWidget::setType(const QStringList &types)
|
||||
|
||||
bool ContextPaneWidget::acceptsType(const QStringList &types)
|
||||
{
|
||||
return types.contains("Text") || types.contains("TextEdit") || types.contains("TextInput") || m_easingWidget->acceptsType(types) ||
|
||||
types.contains("Rectangle") || types.contains("Image") || types.contains("BorderImage");
|
||||
return types.contains(QLatin1String("Text")) || types.contains(QLatin1String("TextEdit")) ||
|
||||
types.contains(QLatin1String("TextInput")) || m_easingWidget->acceptsType(types) ||
|
||||
types.contains(QLatin1String("Rectangle")) || types.contains(QLatin1String("Image")) ||
|
||||
types.contains(QLatin1String("BorderImage"));
|
||||
}
|
||||
|
||||
void ContextPaneWidget::onTogglePane()
|
||||
|
||||
@@ -117,7 +117,7 @@ ContextPaneWidgetImage::ContextPaneWidgetImage(QWidget *parent, bool borderImage
|
||||
}
|
||||
previewDialog();
|
||||
m_fileWidget->setShowComboBox(true);
|
||||
m_fileWidget->setFilter("*.png *.gif *.jpg");
|
||||
m_fileWidget->setFilter(QLatin1String("*.png *.gif *.jpg"));
|
||||
|
||||
connect(m_fileWidget, SIGNAL(fileNameChanged(QUrl)), this, SLOT(onFileNameChanged()));
|
||||
connect(labelFilter, SIGNAL(doubleClicked()), this, SLOT(onPixmapDoubleClicked()));
|
||||
@@ -153,16 +153,16 @@ void ContextPaneWidgetImage::setProperties(QmlJS::PropertyReader *propertyReader
|
||||
|
||||
if (propertyReader->hasProperty(QLatin1String("horizontalTileMode"))) {
|
||||
QString fillMode = propertyReader->readProperty(QLatin1String("horizontalTileMode")).toString();
|
||||
if (fillMode.contains("BorderImage."))
|
||||
fillMode.remove("BorderImage.");
|
||||
if (fillMode.contains(QLatin1String("BorderImage.")))
|
||||
fillMode.remove(QLatin1String("BorderImage."));
|
||||
|
||||
uiBorderImage->horizontalStretchRadioButton->setChecked(true);
|
||||
|
||||
if (fillMode == "Stretch")
|
||||
if (fillMode == QLatin1String("Stretch"))
|
||||
uiBorderImage->horizontalStretchRadioButton->setChecked(true);
|
||||
if (fillMode == "Repeat")
|
||||
if (fillMode == QLatin1String("Repeat"))
|
||||
uiBorderImage->horizontalTileRadioButton->setChecked(true);
|
||||
if (fillMode == "Round")
|
||||
if (fillMode == QLatin1String("Round"))
|
||||
uiBorderImage->horizontalTileRadioButtonNoCrop->setChecked(true);
|
||||
} else {
|
||||
//uiBorderImage
|
||||
@@ -170,16 +170,16 @@ void ContextPaneWidgetImage::setProperties(QmlJS::PropertyReader *propertyReader
|
||||
}
|
||||
if (propertyReader->hasProperty(QLatin1String("verticalTileMode"))) {
|
||||
QString fillMode = propertyReader->readProperty(QLatin1String("verticalTileMode")).toString();
|
||||
if (fillMode.contains("BorderImage."))
|
||||
fillMode.remove("BorderImage.");
|
||||
if (fillMode.contains(QLatin1String("BorderImage.")))
|
||||
fillMode.remove(QLatin1String("BorderImage."));
|
||||
|
||||
uiBorderImage->verticalStretchRadioButton->setChecked(true);
|
||||
|
||||
if (fillMode == "Stretch")
|
||||
if (fillMode == QLatin1String("Stretch"))
|
||||
uiBorderImage->verticalStretchRadioButton->setChecked(true);
|
||||
if (fillMode == "Repeat")
|
||||
if (fillMode == QLatin1String("Repeat"))
|
||||
uiBorderImage->verticalTileRadioButton->setChecked(true);
|
||||
if (fillMode == "Round")
|
||||
if (fillMode == QLatin1String("Round"))
|
||||
uiBorderImage->verticalTileRadioButtonNoCrop->setChecked(true);
|
||||
} else {
|
||||
//uiBorderImage
|
||||
@@ -188,20 +188,20 @@ void ContextPaneWidgetImage::setProperties(QmlJS::PropertyReader *propertyReader
|
||||
} else {
|
||||
if (propertyReader->hasProperty(QLatin1String("fillMode"))) {
|
||||
QString fillMode = propertyReader->readProperty(QLatin1String("fillMode")).toString();
|
||||
if (fillMode.contains("Image."))
|
||||
fillMode.remove("Image.");
|
||||
if (fillMode.contains(QLatin1String("Image.")))
|
||||
fillMode.remove(QLatin1String("Image."));
|
||||
|
||||
ui->stretchRadioButton->setChecked(true);
|
||||
|
||||
if (fillMode == "Image.Tile" || fillMode == "Tile")
|
||||
if (fillMode == QLatin1String("Image.Tile") || fillMode == QLatin1String("Tile"))
|
||||
ui->tileRadioButton->setChecked(true);
|
||||
if (fillMode == "Image.TileVertically" || fillMode == "TileVertically")
|
||||
if (fillMode == QLatin1String("Image.TileVertically") || fillMode == QLatin1String("TileVertically"))
|
||||
ui->horizontalStretchRadioButton->setChecked(true);
|
||||
if (fillMode == "Image.TileHorizontally" || fillMode == "TileHorizontally")
|
||||
if (fillMode == QLatin1String("Image.TileHorizontally") || fillMode == QLatin1String("TileHorizontally"))
|
||||
ui->verticalStretchRadioButton->setChecked(true);
|
||||
if (fillMode == "Image.PreserveAspectFit" || fillMode == "PreserveAspectFit")
|
||||
if (fillMode == QLatin1String("Image.PreserveAspectFit") || fillMode == QLatin1String("PreserveAspectFit"))
|
||||
ui->preserveAspectFitRadioButton->setChecked(true);
|
||||
if (fillMode == "Image.PreserveAspectCrop" || fillMode == "PreserveAspectCrop")
|
||||
if (fillMode == QLatin1String("Image.PreserveAspectCrop") || fillMode == QLatin1String("PreserveAspectCrop"))
|
||||
ui->cropAspectFitRadioButton->setChecked(true);
|
||||
} else {
|
||||
ui->stretchRadioButton->setChecked(true);
|
||||
@@ -210,14 +210,14 @@ void ContextPaneWidgetImage::setProperties(QmlJS::PropertyReader *propertyReader
|
||||
if (propertyReader->hasProperty(QLatin1String("source"))) {
|
||||
QString source = propertyReader->readProperty(QLatin1String("source")).toString();
|
||||
m_fileWidget->setFileName(source);
|
||||
if (QFile::exists(m_path + '/' + source))
|
||||
setPixmap(m_path + '/' + source);
|
||||
if (QFile::exists(m_path + QLatin1Char('/') + source))
|
||||
setPixmap(m_path + QLatin1Char('/') + source);
|
||||
else
|
||||
setPixmap(source);
|
||||
} else {
|
||||
m_sizeLabel->setText("");
|
||||
m_sizeLabel->clear();
|
||||
m_fileWidget->setFileName(QUrl());
|
||||
setPixmap("");
|
||||
setPixmap(QString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -233,27 +233,27 @@ void PreviewDialog::setZoom(int z)
|
||||
m_label->setZoom(z);
|
||||
switch (m_zoom) {
|
||||
case 1:
|
||||
m_zoomLabel->setText("100%");
|
||||
m_zoomLabel->setText(QLatin1String("100%"));
|
||||
m_slider->setValue(1);
|
||||
break;
|
||||
case 2:
|
||||
m_zoomLabel->setText("200%");
|
||||
m_zoomLabel->setText(QLatin1String("200%"));
|
||||
m_slider->setValue(2);
|
||||
break;
|
||||
case 4:
|
||||
m_zoomLabel->setText("400%");
|
||||
m_zoomLabel->setText(QLatin1String("400%"));
|
||||
m_slider->setValue(3);
|
||||
break;
|
||||
case 6:
|
||||
m_zoomLabel->setText("600%");
|
||||
m_zoomLabel->setText(QLatin1String("600%"));
|
||||
m_slider->setValue(4);
|
||||
break;
|
||||
case 8:
|
||||
m_zoomLabel->setText("800%");
|
||||
m_zoomLabel->setText(QLatin1String("800%"));
|
||||
m_slider->setValue(5);
|
||||
break;
|
||||
case 10:
|
||||
m_zoomLabel->setText("1000%");
|
||||
m_zoomLabel->setText(QLatin1String("1000%"));
|
||||
m_slider->setValue(6);
|
||||
break;
|
||||
default: break;
|
||||
@@ -479,10 +479,10 @@ void ContextPaneWidgetImage::setPixmap(const QString &fileName)
|
||||
Qt::TileRule horizontalTileRule;
|
||||
Qt::TileRule verticalTileRule;
|
||||
if (parseSciFile(fileName, pixmapFileName, left, right, top, bottom, horizontalTileRule, verticalTileRule)) {
|
||||
localFileName = QFileInfo(fileName).absoluteDir().absolutePath() + '/' + pixmapFileName;
|
||||
localFileName = QFileInfo(fileName).absoluteDir().absolutePath() + QLatin1Char('/') + pixmapFileName;
|
||||
previewDialog()->previewLabel()->setMargins(left, top, right, bottom);
|
||||
} else { // sci file not parsed correctly
|
||||
uiBorderImage->sizeLabel->setText("");
|
||||
uiBorderImage->sizeLabel->clear();
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -490,7 +490,8 @@ void ContextPaneWidgetImage::setPixmap(const QString &fileName)
|
||||
if (source.isNull())
|
||||
source = pix;
|
||||
previewDialog()->setPixmap(source, previewDialog()->zoom());
|
||||
uiBorderImage->sizeLabel->setText(QString::number(source.width()) + 'x' + QString::number(source.height()));
|
||||
uiBorderImage->sizeLabel->setText(QString::number(source.width()) + QLatin1Char('x')
|
||||
+ QString::number(source.height()));
|
||||
QPainter p(&pix);
|
||||
Qt::TileRule horizontalTileMode = Qt::StretchTile;
|
||||
Qt::TileRule verticalTileMode = Qt::StretchTile;
|
||||
@@ -507,14 +508,14 @@ void ContextPaneWidgetImage::setPixmap(const QString &fileName)
|
||||
qDrawBorderPixmap(&p, QRect(0, 0, 76, 76), margins, source, source.rect(), margins, rules);
|
||||
//p.drawPixmap(0,0,76,76, source);
|
||||
} else {
|
||||
uiBorderImage->sizeLabel->setText("");
|
||||
uiBorderImage->sizeLabel->clear();
|
||||
}
|
||||
uiBorderImage->label->setPixmap(pix);
|
||||
} else {
|
||||
if (QFile(fileName).exists()) {
|
||||
QPixmap source(fileName);
|
||||
previewDialog()->setPixmap(source, 1);
|
||||
ui->sizeLabel->setText(QString::number(source.width()) + 'x' + QString::number(source.height()));
|
||||
ui->sizeLabel->setText(QString::number(source.width()) + QLatin1Char('x') + QString::number(source.height()));
|
||||
QPainter p(&pix);
|
||||
if (ui->stretchRadioButton->isChecked()) {
|
||||
p.drawPixmap(0,0,76,76, source);
|
||||
@@ -543,7 +544,7 @@ void ContextPaneWidgetImage::setPixmap(const QString &fileName)
|
||||
p.drawPixmap(offset, 0, cropped.width(), 76, source);
|
||||
}
|
||||
} else {
|
||||
ui->sizeLabel->setText("");
|
||||
ui->sizeLabel->clear();
|
||||
}
|
||||
|
||||
ui->label->setPixmap(pix);
|
||||
@@ -704,25 +705,25 @@ void PreviewLabel::mousePressEvent(QMouseEvent * event)
|
||||
QApplication::setOverrideCursor(QCursor(Qt::SizeHorCursor));
|
||||
m_dragging_left = true;
|
||||
event->accept();
|
||||
m_hooverInfo->setText("Left " + QString::number(m_left));
|
||||
m_hooverInfo->setText(QLatin1String("Left ") + QString::number(m_left));
|
||||
m_hooverInfo->show();
|
||||
} else if (rangeCheck(m_top * m_zoom, event->pos().y())) {
|
||||
QApplication::setOverrideCursor(QCursor(Qt::SizeVerCursor));
|
||||
m_dragging_top = true;
|
||||
event->accept();
|
||||
m_hooverInfo->setText("Top " + QString::number(m_top));
|
||||
m_hooverInfo->setText(QLatin1String("Top ") + QString::number(m_top));
|
||||
m_hooverInfo->show();
|
||||
} else if (rangeCheck(m_right * m_zoom, width() - event->pos().x())) {
|
||||
QApplication::setOverrideCursor(QCursor(Qt::SizeHorCursor));
|
||||
m_dragging_right = true;
|
||||
event->accept();
|
||||
m_hooverInfo->setText("Right " + QString::number(m_right));
|
||||
m_hooverInfo->setText(QLatin1String("Right ") + QString::number(m_right));
|
||||
m_hooverInfo->show();
|
||||
} else if (rangeCheck(m_bottom * m_zoom, height() - event->pos().y())) {
|
||||
QApplication::setOverrideCursor(QCursor(Qt::SizeVerCursor));
|
||||
m_dragging_bottom = true;
|
||||
event->accept();
|
||||
m_hooverInfo->setText("Bottom " + QString::number(m_bottom));
|
||||
m_hooverInfo->setText(QLatin1String("Bottom ") + QString::number(m_bottom));
|
||||
m_hooverInfo->show();
|
||||
bottom = true;
|
||||
} else {
|
||||
@@ -825,46 +826,46 @@ void PreviewLabel::mouseMoveEvent(QMouseEvent * event)
|
||||
m_left = p.x() / m_zoom;
|
||||
m_left = limitPositive(m_left);
|
||||
event->accept();
|
||||
m_hooverInfo->setText("Left " + QString::number(m_left));
|
||||
m_hooverInfo->setText(QLatin1String("Left ") + QString::number(m_left));
|
||||
update();
|
||||
} else if (m_dragging_top) {
|
||||
m_top = p.y() / m_zoom;
|
||||
m_top = limitPositive(m_top);
|
||||
event->accept();
|
||||
m_hooverInfo->setText("Top " + QString::number(m_top));
|
||||
m_hooverInfo->setText(QLatin1String("Top ") + QString::number(m_top));
|
||||
update();
|
||||
} else if (m_dragging_right) {
|
||||
m_right = (width() - p.x()) / m_zoom;
|
||||
m_right = limitPositive(m_right);
|
||||
event->accept();
|
||||
m_hooverInfo->setText("Right " + QString::number(m_right));
|
||||
m_hooverInfo->setText(QLatin1String("Right ") + QString::number(m_right));
|
||||
update();
|
||||
} else if (m_dragging_bottom) {
|
||||
m_bottom = (height() - p.y()) / m_zoom;
|
||||
m_bottom = limitPositive(m_bottom);
|
||||
event->accept();
|
||||
m_hooverInfo->setText("Bottom " + QString::number(m_bottom));
|
||||
m_hooverInfo->setText(QLatin1String("Bottom ") + QString::number(m_bottom));
|
||||
bottom = true;
|
||||
update();
|
||||
} else if (rangeCheck(m_left * m_zoom, p.x())) {
|
||||
QApplication::setOverrideCursor(QCursor(Qt::SizeHorCursor));
|
||||
event->accept();
|
||||
m_hooverInfo->setText("Left " + QString::number(m_left));
|
||||
m_hooverInfo->setText(QLatin1String("Left ") + QString::number(m_left));
|
||||
m_hooverInfo->show();
|
||||
} else if (rangeCheck(m_top * m_zoom, p.y())) {
|
||||
QApplication::setOverrideCursor(QCursor(Qt::SizeVerCursor));
|
||||
event->accept();
|
||||
m_hooverInfo->setText("Top " + QString::number(m_top));
|
||||
m_hooverInfo->setText(QLatin1String("Top ") + QString::number(m_top));
|
||||
m_hooverInfo->show();
|
||||
} else if (rangeCheck(m_right * m_zoom, width() - p.x())) {
|
||||
QApplication::setOverrideCursor(QCursor(Qt::SizeHorCursor));
|
||||
event->accept();
|
||||
m_hooverInfo->setText("Right " + QString::number(m_right));
|
||||
m_hooverInfo->setText(QLatin1String("Right ") + QString::number(m_right));
|
||||
m_hooverInfo->show();
|
||||
} else if (rangeCheck(m_bottom * m_zoom, height() - p.y())) {
|
||||
QApplication::setOverrideCursor(QCursor(Qt::SizeVerCursor));
|
||||
event->accept();
|
||||
m_hooverInfo->setText("Bottom " + QString::number(m_bottom));
|
||||
m_hooverInfo->setText(QLatin1String("Bottom ") + QString::number(m_bottom));
|
||||
m_hooverInfo->show();
|
||||
bottom = true;
|
||||
} else {
|
||||
|
||||
@@ -80,7 +80,7 @@ void ContextPaneWidgetRectangle::setProperties(QmlJS::PropertyReader *propertyRe
|
||||
m_hasBorder = false;
|
||||
|
||||
if (propertyReader->hasProperty(QLatin1String("color"))) {
|
||||
QString str = propertyReader->readProperty("color").toString();
|
||||
QString str = propertyReader->readProperty(QLatin1String("color")).toString();
|
||||
if (QmlJS::toQColor(str).alpha() == 0)
|
||||
m_none = true;
|
||||
ui->colorColorButton->setColor(str);
|
||||
@@ -90,7 +90,7 @@ void ContextPaneWidgetRectangle::setProperties(QmlJS::PropertyReader *propertyRe
|
||||
}
|
||||
|
||||
if (propertyReader->hasProperty(QLatin1String("border.color"))) {
|
||||
ui->borderColorButton->setColor(propertyReader->readProperty("border.color").toString());
|
||||
ui->borderColorButton->setColor(propertyReader->readProperty(QLatin1String("border.color")).toString());
|
||||
m_hasBorder = true;
|
||||
} else {
|
||||
ui->borderColorButton->setColor(QLatin1String("transparent"));
|
||||
@@ -112,11 +112,11 @@ void ContextPaneWidgetRectangle::setProperties(QmlJS::PropertyReader *propertyRe
|
||||
if (m_hasGradient && isGradientEditingEnabled()) {
|
||||
bool isBound;
|
||||
ui->colorGradient->setChecked(true);
|
||||
ui->gradientLine->setGradient(propertyReader->parseGradient("gradient", &isBound));
|
||||
ui->gradientLine->setGradient(propertyReader->parseGradient(QLatin1String("gradient"), &isBound));
|
||||
if (isBound) {
|
||||
ui->gradientLabel->setEnabled(false);
|
||||
ui->gradientLine->setEnabled(false);
|
||||
ui->colorColorButton->setColor("invalidColor");
|
||||
ui->colorColorButton->setColor(QLatin1String("invalidColor"));
|
||||
}
|
||||
} else {
|
||||
ui->gradientLine->setEnabled(false);
|
||||
@@ -205,7 +205,8 @@ void ContextPaneWidgetRectangle::onColorNoneClicked()
|
||||
{
|
||||
if (ui->colorNone->isChecked()) {
|
||||
ui->colorGradient->setEnabled(isGradientEditingEnabled());
|
||||
emit removeAndChangeProperty("gradient", "color", "transparent", true);
|
||||
emit removeAndChangeProperty(QLatin1String("gradient"), QLatin1String("color"),
|
||||
QLatin1String("transparent"), true);
|
||||
}
|
||||
ui->colorGradient->setEnabled(isGradientEditingEnabled());
|
||||
}
|
||||
@@ -214,7 +215,8 @@ void ContextPaneWidgetRectangle::onColorSolidClicked()
|
||||
{
|
||||
if (ui->colorSolid->isChecked()) {
|
||||
ui->gradientLine->setEnabled(false);
|
||||
emit removeAndChangeProperty("gradient", "color", "\"black\"", true);
|
||||
emit removeAndChangeProperty(QLatin1String("gradient"), QLatin1String("color"),
|
||||
QLatin1String("\"black\""), true);
|
||||
}
|
||||
ui->colorGradient->setEnabled(isGradientEditingEnabled());
|
||||
}
|
||||
@@ -222,15 +224,15 @@ void ContextPaneWidgetRectangle::onColorSolidClicked()
|
||||
void ContextPaneWidgetRectangle::onBorderNoneClicked()
|
||||
{
|
||||
if (ui->borderNone->isChecked()) {
|
||||
emit removeProperty("border.color");
|
||||
emit removeProperty("border.width");//###
|
||||
emit removeProperty(QLatin1String("border.color"));
|
||||
emit removeProperty(QLatin1String("border.width"));//###
|
||||
}
|
||||
}
|
||||
|
||||
void ContextPaneWidgetRectangle::onBorderSolidClicked()
|
||||
{
|
||||
if (ui->borderSolid->isChecked()) {
|
||||
emit propertyChanged("border.color", "\"black\"");
|
||||
emit propertyChanged(QLatin1String("border.color"), QLatin1String("\"black\""));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -258,7 +260,7 @@ void ContextPaneWidgetRectangle::timerEvent(QTimerEvent *event)
|
||||
m_gradientTimer = -1;
|
||||
|
||||
QLinearGradient gradient = ui->gradientLine->gradient();
|
||||
QString str = "Gradient {\n";
|
||||
QString str = QLatin1String("Gradient {\n");
|
||||
foreach (const QGradientStop &stop, gradient.stops()) {
|
||||
str += QLatin1String("GradientStop {\n");
|
||||
str += QLatin1String("position: ") + QString::number(stop.first, 'f', 2) + QLatin1String(";\n");
|
||||
@@ -266,7 +268,7 @@ void ContextPaneWidgetRectangle::timerEvent(QTimerEvent *event)
|
||||
str += QLatin1String("}\n");
|
||||
}
|
||||
str += QLatin1String("}");
|
||||
emit propertyChanged("gradient", str);
|
||||
emit propertyChanged(QLatin1String("gradient"), str);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -101,10 +101,10 @@ CustomColorDialog::CustomColorDialog(QWidget *parent) : QFrame(parent )
|
||||
|
||||
gridLayout->addWidget(colorFrameWidget, 0, 2, 2, 1);
|
||||
|
||||
gridLayout->addWidget(new QLabel("R", this), 0, 3, 1, 1);
|
||||
gridLayout->addWidget(new QLabel("G", this), 1, 3, 1, 1);
|
||||
gridLayout->addWidget(new QLabel("B", this), 2, 3, 1, 1);
|
||||
gridLayout->addWidget(new QLabel("A", this), 3, 3, 1, 1);
|
||||
gridLayout->addWidget(new QLabel(QLatin1String("R"), this), 0, 3, 1, 1);
|
||||
gridLayout->addWidget(new QLabel(QLatin1String("G"), this), 1, 3, 1, 1);
|
||||
gridLayout->addWidget(new QLabel(QLatin1String("B"), this), 2, 3, 1, 1);
|
||||
gridLayout->addWidget(new QLabel(QLatin1String("A"), this), 3, 3, 1, 1);
|
||||
|
||||
gridLayout->addWidget(m_rSpinBox, 0, 4, 1, 1);
|
||||
gridLayout->addWidget(m_gSpinBox, 1, 4, 1, 1);
|
||||
|
||||
@@ -52,7 +52,7 @@ class EasingSimulation : public QObject
|
||||
public:
|
||||
QGraphicsView *m_g;
|
||||
EasingSimulation(QObject *parent=0, QGraphicsView *v=0):QObject(parent) {
|
||||
m_qtLogo = new PixmapItem(QPixmap(":/qt_logo.png"));
|
||||
m_qtLogo = new PixmapItem(QPixmap(QLatin1String(":/qt_logo.png")));
|
||||
m_scene.addItem(m_qtLogo);
|
||||
m_scene.setSceneRect(0,0,v->viewport()->width(),m_qtLogo->boundingRect().height());
|
||||
m_qtLogo->hide();
|
||||
@@ -145,20 +145,20 @@ EasingContextPane::~EasingContextPane()
|
||||
|
||||
bool EasingContextPane::acceptsType(const QStringList &types)
|
||||
{
|
||||
return types.contains("NumberAnimation") ||
|
||||
types.contains("PropertyAnimation") ||
|
||||
types.contains("ColorAnimation") ||
|
||||
types.contains("RotationAnimation");
|
||||
return types.contains(QLatin1String("NumberAnimation")) ||
|
||||
types.contains(QLatin1String("PropertyAnimation")) ||
|
||||
types.contains(QLatin1String("ColorAnimation")) ||
|
||||
types.contains(QLatin1String("RotationAnimation"));
|
||||
}
|
||||
|
||||
void EasingContextPane::setProperties(QmlJS::PropertyReader *propertyReader)
|
||||
{
|
||||
m_easingGraph->setGeometry(ui->graphicsView->geometry().adjusted(2,2,-2,-2));
|
||||
QString newEasingType = QString("Linear");
|
||||
QString newEasingType = QLatin1String("Linear");
|
||||
if (propertyReader->hasProperty(QLatin1String("easing.type"))) {
|
||||
newEasingType = propertyReader->readProperty(QLatin1String("easing.type")).toString();
|
||||
if (newEasingType.contains("."))
|
||||
newEasingType = newEasingType.right(newEasingType.length() - newEasingType.indexOf(".") - 1);
|
||||
if (newEasingType.contains(QLatin1Char('.')))
|
||||
newEasingType = newEasingType.right(newEasingType.length() - newEasingType.indexOf(QLatin1Char('.')) - 1);
|
||||
}
|
||||
|
||||
m_easingGraph->setEasingName(newEasingType);
|
||||
@@ -306,13 +306,13 @@ void QmlEditorWidgets::EasingContextPane::on_durationSpinBox_valueChanged(int ne
|
||||
|
||||
void QmlEditorWidgets::EasingContextPane::on_easingShapeComboBox_currentIndexChanged(QString newShape)
|
||||
{
|
||||
if (newShape=="Linear")
|
||||
if (newShape==QLatin1String("Linear"))
|
||||
setLinear();
|
||||
else if (newShape=="Bounce")
|
||||
else if (newShape==QLatin1String("Bounce"))
|
||||
setBounce();
|
||||
else if (newShape=="Elastic")
|
||||
else if (newShape==QLatin1String("Elastic"))
|
||||
setElastic();
|
||||
else if (newShape=="Back")
|
||||
else if (newShape==QLatin1String("Back"))
|
||||
setBack();
|
||||
else
|
||||
setOthers();
|
||||
@@ -343,7 +343,8 @@ void QmlEditorWidgets::EasingContextPane::on_easingExtremesComboBox_currentIndex
|
||||
void QmlEditorWidgets::EasingContextPane::on_amplitudeSpinBox_valueChanged(double newAmplitude)
|
||||
{
|
||||
if ((newAmplitude != m_easingGraph->amplitude()) &&
|
||||
(m_easingGraph->easingShape()=="Bounce" || m_easingGraph->easingShape()=="Elastic")) {
|
||||
(m_easingGraph->easingShape()==QLatin1String("Bounce")
|
||||
|| m_easingGraph->easingShape()==QLatin1String("Elastic"))) {
|
||||
m_easingGraph->setAmplitude(newAmplitude);
|
||||
m_simulation->updateCurve(m_easingGraph->easingCurve(),ui->durationSpinBox->value());
|
||||
emit propertyChanged(QLatin1String("easing.amplitude"), newAmplitude);
|
||||
@@ -352,7 +353,7 @@ void QmlEditorWidgets::EasingContextPane::on_amplitudeSpinBox_valueChanged(doubl
|
||||
|
||||
void QmlEditorWidgets::EasingContextPane::on_periodSpinBox_valueChanged(double newPeriod)
|
||||
{
|
||||
if ((newPeriod != m_easingGraph->period()) && (m_easingGraph->easingShape()=="Elastic")) {
|
||||
if ((newPeriod != m_easingGraph->period()) && (m_easingGraph->easingShape()==QLatin1String("Elastic"))) {
|
||||
m_easingGraph->setPeriod(newPeriod);
|
||||
m_simulation->updateCurve(m_easingGraph->easingCurve(),ui->durationSpinBox->value());
|
||||
emit propertyChanged(QLatin1String("easing.period"), newPeriod);
|
||||
@@ -362,7 +363,7 @@ void QmlEditorWidgets::EasingContextPane::on_periodSpinBox_valueChanged(double n
|
||||
|
||||
void QmlEditorWidgets::EasingContextPane::on_overshootSpinBox_valueChanged(double newOvershoot)
|
||||
{
|
||||
if ((newOvershoot != m_easingGraph->overshoot()) && (m_easingGraph->easingShape()=="Back")) {
|
||||
if ((newOvershoot != m_easingGraph->overshoot()) && (m_easingGraph->easingShape()==QLatin1String("Back"))) {
|
||||
m_easingGraph->setOvershoot(newOvershoot);
|
||||
m_simulation->updateCurve(m_easingGraph->easingCurve(),ui->durationSpinBox->value());
|
||||
emit propertyChanged(QLatin1String("easing.overshoot"), newOvershoot);
|
||||
|
||||
@@ -106,17 +106,17 @@ QEasingCurve EasingGraph::easingCurve() const
|
||||
QString EasingGraph::easingShape() const
|
||||
{
|
||||
QString name = easingName();
|
||||
if (name.left(5)=="InOut") return name.right(name.length()-5);
|
||||
if (name.left(5)=="OutIn") return name.right(name.length()-5);
|
||||
if (name.left(3)=="Out") return name.right(name.length()-3);
|
||||
if (name.left(2)=="In") return name.right(name.length()-2);
|
||||
if (name.left(5)==QLatin1String("InOut")) return name.right(name.length()-5);
|
||||
if (name.left(5)==QLatin1String("OutIn")) return name.right(name.length()-5);
|
||||
if (name.left(3)==QLatin1String("Out")) return name.right(name.length()-3);
|
||||
if (name.left(2)==QLatin1String("In")) return name.right(name.length()-2);
|
||||
return name;
|
||||
}
|
||||
|
||||
void EasingGraph::setEasingShape(const QString &newShape)
|
||||
{
|
||||
if (easingShape() != newShape) {
|
||||
if (newShape=="Linear")
|
||||
if (newShape==QLatin1String("Linear"))
|
||||
setEasingName(newShape);
|
||||
else
|
||||
setEasingName(m_easingExtremes+newShape);
|
||||
@@ -126,10 +126,10 @@ void EasingGraph::setEasingShape(const QString &newShape)
|
||||
QString EasingGraph::easingExtremes() const
|
||||
{
|
||||
QString name = easingName();
|
||||
if (name.left(5)=="InOut") return "InOut";
|
||||
if (name.left(5)=="OutIn") return "OutIn";
|
||||
if (name.left(3)=="Out") return "Out";
|
||||
if (name.left(2)=="In") return "In";
|
||||
if (name.left(5)==QLatin1String("InOut")) return QLatin1String("InOut");
|
||||
if (name.left(5)==QLatin1String("OutIn")) return QLatin1String("OutIn");
|
||||
if (name.left(3)==QLatin1String("Out")) return QLatin1String("Out");
|
||||
if (name.left(2)==QLatin1String("In")) return QLatin1String("In");
|
||||
return QString();
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ void EasingGraph::setEasingExtremes(const QString &newExtremes)
|
||||
{
|
||||
if (m_easingExtremes != newExtremes) {
|
||||
m_easingExtremes = newExtremes;
|
||||
if (easingShape()!="Linear")
|
||||
if (easingShape()!=QLatin1String("Linear"))
|
||||
setEasingName(newExtremes+easingShape());
|
||||
}
|
||||
}
|
||||
@@ -167,7 +167,7 @@ qreal EasingGraph::overshoot() const
|
||||
|
||||
void EasingGraph::setOvershoot(qreal newOvershoot)
|
||||
{
|
||||
if ((overshoot() != newOvershoot) && (easingShape()=="Back")) {
|
||||
if ((overshoot() != newOvershoot) && (easingShape()==QLatin1String("Back"))) {
|
||||
m_curveFunction.setOvershoot(newOvershoot);
|
||||
emit overshootChanged();
|
||||
update();
|
||||
@@ -180,7 +180,7 @@ qreal EasingGraph::amplitude() const
|
||||
|
||||
void EasingGraph::setAmplitude(qreal newAmplitude)
|
||||
{
|
||||
if ((amplitude() != newAmplitude) && ((easingShape()=="Bounce") ||(easingShape()=="Elastic"))) {
|
||||
if ((amplitude() != newAmplitude) && ((easingShape()==QLatin1String("Bounce")) ||(easingShape()==QLatin1String("Elastic")))) {
|
||||
m_curveFunction.setAmplitude(newAmplitude);
|
||||
emit amplitudeChanged();
|
||||
update();
|
||||
@@ -194,7 +194,7 @@ qreal EasingGraph::period() const
|
||||
|
||||
void EasingGraph::setPeriod(qreal newPeriod)
|
||||
{
|
||||
if ((period() != newPeriod) && (easingShape()=="Elastic")) {
|
||||
if ((period() != newPeriod) && (easingShape()==QLatin1String("Elastic"))) {
|
||||
m_curveFunction.setPeriod(newPeriod);
|
||||
emit periodChanged();
|
||||
update();
|
||||
|
||||
@@ -42,7 +42,11 @@
|
||||
|
||||
namespace QmlEditorWidgets {
|
||||
|
||||
FileWidget::FileWidget(QWidget *parent) : QWidget(parent), m_filter("(*.*)"), m_showComboBox(false), m_lock(false)
|
||||
FileWidget::FileWidget(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
m_filter(QLatin1String("(*.*)")),
|
||||
m_showComboBox(false),
|
||||
m_lock(false)
|
||||
{
|
||||
m_pushButton = new QToolButton(this);
|
||||
m_pushButton->setFixedWidth(32);
|
||||
@@ -56,7 +60,7 @@ FileWidget::FileWidget(QWidget *parent) : QWidget(parent), m_filter("(*.*)"), m_
|
||||
layout->addWidget(m_comboBox);
|
||||
m_comboBox->setEditable(true);
|
||||
layout->addWidget(m_pushButton);
|
||||
m_pushButton->setText("...");
|
||||
m_pushButton->setText(QLatin1String("..."));
|
||||
connect(m_lineEdit, SIGNAL(editingFinished()), this, SLOT(lineEditChanged()));
|
||||
connect(m_pushButton, SIGNAL(released()), this, SLOT(onButtonReleased()));
|
||||
connect(m_comboBox, SIGNAL(editTextChanged(QString)), this, SLOT(comboBoxChanged()));
|
||||
@@ -126,7 +130,7 @@ void FileWidget::setupComboBox()
|
||||
if (m_path.isValid())
|
||||
dir = QDir(m_path.toLocalFile());
|
||||
|
||||
QStringList filterList = m_filter.split(' ');
|
||||
QStringList filterList = m_filter.split(QLatin1Char(' '));
|
||||
|
||||
QDirIterator it(dir.absolutePath(), filterList, QDir::Files, QDirIterator::Subdirectories);
|
||||
while (it.hasNext()) {
|
||||
|
||||
@@ -71,9 +71,9 @@ void FontSizeSpinBox::setText()
|
||||
{
|
||||
QString text = QString::number(m_value);
|
||||
if (isPointSize())
|
||||
text.append(" pt");
|
||||
text.append(QLatin1String(" pt"));
|
||||
else
|
||||
text.append(" px");
|
||||
text.append(QLatin1String(" px"));
|
||||
lineEdit()->setText(text);
|
||||
|
||||
}
|
||||
@@ -81,20 +81,20 @@ void FontSizeSpinBox::setText()
|
||||
void FontSizeSpinBox::onEditingFinished()
|
||||
{
|
||||
QString str = lineEdit()->text();
|
||||
if (str.contains("px")) {
|
||||
if (str.contains(QLatin1String("px"))) {
|
||||
setIsPixelSize(true);
|
||||
str.remove("px");
|
||||
str.remove(QLatin1String("px"));
|
||||
setValue(str.toInt());
|
||||
} else {
|
||||
setIsPointSize(true);
|
||||
str.remove("pt");
|
||||
str.remove(QLatin1String("pt"));
|
||||
setValue(str.toInt());
|
||||
}
|
||||
}
|
||||
|
||||
QValidator::State FontSizeSpinBox::validate (QString &input, int &p) const
|
||||
{
|
||||
QRegExp rx("\\d+\\s*(px|pt)");
|
||||
QRegExp rx(QLatin1String("\\d+\\s*(px|pt)"));
|
||||
QRegExpValidator v(rx, 0);
|
||||
return v.validate(input, p);
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ static inline QColor invertColor(const QColor color)
|
||||
GradientLine::GradientLine(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
m_activeColor(Qt::black),
|
||||
m_gradientName("gradient"),
|
||||
m_gradientName(QLatin1String("gradient")),
|
||||
m_colorIndex(0),
|
||||
m_dragActive(false),
|
||||
m_yOffset(0),
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
TEMPLATE = lib
|
||||
TARGET = QmlEditorWidgets
|
||||
|
||||
DEFINES += QWEAKPOINTER_ENABLE_ARROW
|
||||
DEFINES += QWEAKPOINTER_ENABLE_ARROW QT_NO_CAST_FROM_ASCII
|
||||
|
||||
unix:QMAKE_CXXFLAGS_DEBUG += -O3
|
||||
|
||||
|
||||
@@ -8,7 +8,8 @@ QtcLibrary {
|
||||
cpp.defines: base.concat([
|
||||
"QWEAKPOINTER_ENABLE_ARROW",
|
||||
"BUILD_QMLEDITORWIDGETS_LIB",
|
||||
"QT_CREATOR"
|
||||
"QT_CREATOR",
|
||||
"QT_NO_CAST_FROM_ASCII"
|
||||
])
|
||||
cpp.optimization: "fast"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user