forked from len0rd/rockbox
themeeditor: Make it compile with current Qt5.
- Replace use of obsolete members with their replacements. - Fix type issue that requires explicitly creating the right object now. - Update project file to work with Qt5. Change-Id: I3af2b1520796e977e58c0a01e165c77c469a23b9
This commit is contained in:
parent
ff38666a19
commit
fa330c109d
10 changed files with 35 additions and 35 deletions
|
@ -227,7 +227,7 @@ void RBScreen::makeCustomUI(QString id)
|
||||||
|
|
||||||
void RBScreen::endSbsRender()
|
void RBScreen::endSbsRender()
|
||||||
{
|
{
|
||||||
sbsChildren = children();
|
sbsChildren = childItems();
|
||||||
|
|
||||||
QList<int> keys = fonts.keys();
|
QList<int> keys = fonts.keys();
|
||||||
for(QList<int>::iterator i = keys.begin(); i != keys.end(); i++)
|
for(QList<int>::iterator i = keys.begin(); i != keys.end(); i++)
|
||||||
|
@ -259,7 +259,7 @@ QColor RBScreen::stringToColor(QString str, QColor fallback)
|
||||||
{
|
{
|
||||||
for(int i = 0; i < 6; i++)
|
for(int i = 0; i < 6; i++)
|
||||||
{
|
{
|
||||||
char c = str[i].toAscii();
|
char c = str[i].toLatin1();
|
||||||
if(!((c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F') ||
|
if(!((c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F') ||
|
||||||
isdigit(c)))
|
isdigit(c)))
|
||||||
{
|
{
|
||||||
|
@ -274,9 +274,9 @@ QColor RBScreen::stringToColor(QString str, QColor fallback)
|
||||||
}
|
}
|
||||||
else if(str.length() == 1)
|
else if(str.length() == 1)
|
||||||
{
|
{
|
||||||
if(isdigit(str[0].toAscii()) && str[0].toAscii() <= '3')
|
if(isdigit(str[0].toLatin1()) && str[0].toLatin1() <= '3')
|
||||||
{
|
{
|
||||||
int shade = 255 * (str[0].toAscii() - '0') / 3;
|
int shade = 255 * (str[0].toLatin1() - '0') / 3;
|
||||||
retval = QColor(shade, shade, shade);
|
retval = QColor(shade, shade, shade);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -143,7 +143,7 @@ void ConfigDocument::save()
|
||||||
}
|
}
|
||||||
|
|
||||||
fout.open(QFile::WriteOnly);
|
fout.open(QFile::WriteOnly);
|
||||||
fout.write(toPlainText().toAscii());
|
fout.write(toPlainText().toLatin1());
|
||||||
fout.close();
|
fout.close();
|
||||||
|
|
||||||
saved = toPlainText();
|
saved = toPlainText();
|
||||||
|
@ -174,7 +174,7 @@ void ConfigDocument::saveAs()
|
||||||
|
|
||||||
QFile fout(filePath);
|
QFile fout(filePath);
|
||||||
fout.open(QFile::WriteOnly);
|
fout.open(QFile::WriteOnly);
|
||||||
fout.write(toPlainText().toAscii());
|
fout.write(toPlainText().toLatin1());
|
||||||
fout.close();
|
fout.close();
|
||||||
|
|
||||||
saved = toPlainText();
|
saved = toPlainText();
|
||||||
|
@ -415,14 +415,14 @@ void ConfigDocument::settingsChanged()
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
settings.beginGroup("SkinDocument");
|
settings.beginGroup("SkinDocument");
|
||||||
|
|
||||||
QColor fg = settings.value("fgColor", Qt::black).value<QColor>();
|
QColor fg = settings.value("fgColor", QColor(Qt::black)).value<QColor>();
|
||||||
QColor bg = settings.value("bgColor", Qt::white).value<QColor>();
|
QColor bg = settings.value("bgColor", QColor(Qt::white)).value<QColor>();
|
||||||
QPalette palette;
|
QPalette palette;
|
||||||
palette.setColor(QPalette::All, QPalette::Base, bg);
|
palette.setColor(QPalette::All, QPalette::Base, bg);
|
||||||
palette.setColor(QPalette::All, QPalette::Text, fg);
|
palette.setColor(QPalette::All, QPalette::Text, fg);
|
||||||
editor->setPalette(palette);
|
editor->setPalette(palette);
|
||||||
|
|
||||||
QColor highlight = settings.value("errorColor", Qt::red).value<QColor>();
|
QColor highlight = settings.value("errorColor", QColor(Qt::red)).value<QColor>();
|
||||||
editor->setErrorColor(highlight);
|
editor->setErrorColor(highlight);
|
||||||
|
|
||||||
/* Setting the font */
|
/* Setting the font */
|
||||||
|
|
|
@ -874,7 +874,7 @@ void EditorWindow::createFile(QString filename, QString contents)
|
||||||
QFile fout(filename);
|
QFile fout(filename);
|
||||||
fout.open(QFile::WriteOnly);
|
fout.open(QFile::WriteOnly);
|
||||||
|
|
||||||
fout.write(contents.toAscii());
|
fout.write(contents.toLatin1());
|
||||||
|
|
||||||
fout.close();
|
fout.close();
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,13 +85,13 @@ void PreferencesDialog::loadColors()
|
||||||
/* Buttons from the editor group */
|
/* Buttons from the editor group */
|
||||||
settings.beginGroup("SkinDocument");
|
settings.beginGroup("SkinDocument");
|
||||||
|
|
||||||
fgColor = settings.value("fgColor", Qt::black).value<QColor>();
|
fgColor = settings.value("fgColor", QColor(Qt::black)).value<QColor>();
|
||||||
setButtonColor(ui->fgButton, fgColor);
|
setButtonColor(ui->fgButton, fgColor);
|
||||||
|
|
||||||
bgColor = settings.value("bgColor", Qt::white).value<QColor>();
|
bgColor = settings.value("bgColor", QColor(Qt::white)).value<QColor>();
|
||||||
setButtonColor(ui->bgButton, bgColor);
|
setButtonColor(ui->bgButton, bgColor);
|
||||||
|
|
||||||
errorColor = settings.value("errorColor", Qt::red).value<QColor>();
|
errorColor = settings.value("errorColor", QColor(Qt::red)).value<QColor>();
|
||||||
setButtonColor(ui->errorButton, errorColor);
|
setButtonColor(ui->errorButton, errorColor);
|
||||||
|
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
|
@ -204,7 +204,7 @@ void ProjectExporter::checkWPS(ProjectModel* project, QString file)
|
||||||
fin.close();
|
fin.close();
|
||||||
|
|
||||||
skin_element* root;
|
skin_element* root;
|
||||||
root = skin_parse(contents.toAscii());
|
root = skin_parse(contents.toLatin1());
|
||||||
if(!root)
|
if(!root)
|
||||||
{
|
{
|
||||||
addWarning(tr("Couldn't parse ") + file.split("/").last());
|
addWarning(tr("Couldn't parse ") + file.split("/").last());
|
||||||
|
|
|
@ -197,14 +197,14 @@ void SkinDocument::settingsChanged()
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
settings.beginGroup("SkinDocument");
|
settings.beginGroup("SkinDocument");
|
||||||
|
|
||||||
QColor fg = settings.value("fgColor", Qt::black).value<QColor>();
|
QColor fg = settings.value("fgColor", QColor(Qt::black)).value<QColor>();
|
||||||
QColor bg = settings.value("bgColor", Qt::white).value<QColor>();
|
QColor bg = settings.value("bgColor", QColor(Qt::white)).value<QColor>();
|
||||||
QPalette palette;
|
QPalette palette;
|
||||||
palette.setColor(QPalette::All, QPalette::Base, bg);
|
palette.setColor(QPalette::All, QPalette::Base, bg);
|
||||||
palette.setColor(QPalette::All, QPalette::Text, fg);
|
palette.setColor(QPalette::All, QPalette::Text, fg);
|
||||||
editor->setPalette(palette);
|
editor->setPalette(palette);
|
||||||
|
|
||||||
QColor highlight = settings.value("errorColor", Qt::red).value<QColor>();
|
QColor highlight = settings.value("errorColor", QColor(Qt::red)).value<QColor>();
|
||||||
editor->setErrorColor(highlight);
|
editor->setErrorColor(highlight);
|
||||||
|
|
||||||
/* Setting the font */
|
/* Setting the font */
|
||||||
|
@ -227,7 +227,7 @@ void SkinDocument::cursorChanged()
|
||||||
QTextCursor line = editor->textCursor();
|
QTextCursor line = editor->textCursor();
|
||||||
line.movePosition(QTextCursor::StartOfLine);
|
line.movePosition(QTextCursor::StartOfLine);
|
||||||
line.movePosition(QTextCursor::EndOfLine, QTextCursor::KeepAnchor);
|
line.movePosition(QTextCursor::EndOfLine, QTextCursor::KeepAnchor);
|
||||||
skin_parse(line.selectedText().toAscii());
|
skin_parse(line.selectedText().toLatin1());
|
||||||
if(skin_error_line() > 0)
|
if(skin_error_line() > 0)
|
||||||
parseStatus = tr("Error on line ") +
|
parseStatus = tr("Error on line ") +
|
||||||
QString::number(line.blockNumber() + 1)
|
QString::number(line.blockNumber() + 1)
|
||||||
|
@ -263,7 +263,7 @@ void SkinDocument::codeChanged()
|
||||||
|
|
||||||
editor->clearErrors();
|
editor->clearErrors();
|
||||||
parseStatus = model->changeTree(editor->document()->
|
parseStatus = model->changeTree(editor->document()->
|
||||||
toPlainText().toAscii());
|
toPlainText().toLatin1());
|
||||||
|
|
||||||
treeInSync = true;
|
treeInSync = true;
|
||||||
emit antiSync(false);
|
emit antiSync(false);
|
||||||
|
@ -294,7 +294,7 @@ void SkinDocument::codeChanged()
|
||||||
rest.removeSelectedText();
|
rest.removeSelectedText();
|
||||||
base += skin_error_line();
|
base += skin_error_line();
|
||||||
|
|
||||||
skin_parse(doc.toPlainText().toAscii());
|
skin_parse(doc.toPlainText().toLatin1());
|
||||||
|
|
||||||
if(skin_error_line() > 0)
|
if(skin_error_line() > 0)
|
||||||
editor->addError(base + skin_error_line());
|
editor->addError(base + skin_error_line());
|
||||||
|
@ -338,7 +338,7 @@ void SkinDocument::save()
|
||||||
}
|
}
|
||||||
|
|
||||||
fout.open(QFile::WriteOnly);
|
fout.open(QFile::WriteOnly);
|
||||||
fout.write(editor->document()->toPlainText().toAscii());
|
fout.write(editor->document()->toPlainText().toLatin1());
|
||||||
fout.close();
|
fout.close();
|
||||||
|
|
||||||
saved = editor->document()->toPlainText();
|
saved = editor->document()->toPlainText();
|
||||||
|
@ -372,7 +372,7 @@ void SkinDocument::saveAs()
|
||||||
|
|
||||||
QFile fout(fileName);
|
QFile fout(fileName);
|
||||||
fout.open(QFile::WriteOnly);
|
fout.open(QFile::WriteOnly);
|
||||||
fout.write(editor->document()->toPlainText().toAscii());
|
fout.write(editor->document()->toPlainText().toLatin1());
|
||||||
fout.close();
|
fout.close();
|
||||||
|
|
||||||
saved = editor->document()->toPlainText();
|
saved = editor->document()->toPlainText();
|
||||||
|
|
|
@ -63,7 +63,7 @@ void SkinHighlighter::highlightBlock(const QString& text)
|
||||||
if(text.length() - i < 2)
|
if(text.length() - i < 2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(find_escape_character(text[i + 1].toAscii()))
|
if(find_escape_character(text[i + 1].toLatin1()))
|
||||||
{
|
{
|
||||||
/* Checking for escaped characters */
|
/* Checking for escaped characters */
|
||||||
|
|
||||||
|
@ -82,8 +82,8 @@ void SkinHighlighter::highlightBlock(const QString& text)
|
||||||
|
|
||||||
if(text.length() - i >= 3)
|
if(text.length() - i >= 3)
|
||||||
{
|
{
|
||||||
lookup[0] = text[i + 1].toAscii();
|
lookup[0] = text[i + 1].toLatin1();
|
||||||
lookup[1] = text[i + 2].toAscii();
|
lookup[1] = text[i + 2].toLatin1();
|
||||||
|
|
||||||
found = find_tag(lookup);
|
found = find_tag(lookup);
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@ void SkinHighlighter::highlightBlock(const QString& text)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lookup[1] = '\0';
|
lookup[1] = '\0';
|
||||||
lookup[0] = text[i + 1].toAscii();
|
lookup[0] = text[i + 1].toLatin1();
|
||||||
found = find_tag(lookup);
|
found = find_tag(lookup);
|
||||||
|
|
||||||
if(found)
|
if(found)
|
||||||
|
@ -121,8 +121,8 @@ void SkinHighlighter::highlightBlock(const QString& text)
|
||||||
|
|
||||||
if(text.length() - i >= 4)
|
if(text.length() - i >= 4)
|
||||||
{
|
{
|
||||||
lookup[0] = text[i + 2].toAscii();
|
lookup[0] = text[i + 2].toLatin1();
|
||||||
lookup[1] = text[i + 3].toAscii();
|
lookup[1] = text[i + 3].toLatin1();
|
||||||
|
|
||||||
found = find_tag(lookup);
|
found = find_tag(lookup);
|
||||||
}
|
}
|
||||||
|
@ -135,7 +135,7 @@ void SkinHighlighter::highlightBlock(const QString& text)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lookup[1] = '\0';
|
lookup[1] = '\0';
|
||||||
lookup[0] = text[i + 2].toAscii();
|
lookup[0] = text[i + 2].toLatin1();
|
||||||
|
|
||||||
found = find_tag(lookup);
|
found = find_tag(lookup);
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
#include "editorwindow.h"
|
#include "editorwindow.h"
|
||||||
|
|
||||||
#include <QtGui/QApplication>
|
#include <QApplication>
|
||||||
|
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
|
|
|
@ -242,7 +242,7 @@ bool ParseTreeModel::setData(const QModelIndex &index, const QVariant &value,
|
||||||
free(param->data.text);
|
free(param->data.text);
|
||||||
|
|
||||||
param->type = skin_tag_parameter::STRING;
|
param->type = skin_tag_parameter::STRING;
|
||||||
param->data.text = strdup(value.toString().trimmed().toAscii());
|
param->data.text = strdup(value.toString().trimmed().toLatin1());
|
||||||
}
|
}
|
||||||
else if(tolower(param->type_code) == 'i')
|
else if(tolower(param->type_code) == 'i')
|
||||||
{
|
{
|
||||||
|
@ -265,7 +265,7 @@ bool ParseTreeModel::setData(const QModelIndex &index, const QVariant &value,
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
free(element->data);
|
free(element->data);
|
||||||
element->data = strdup(value.toString().trimmed().toAscii());
|
element->data = strdup(value.toString().trimmed().toLatin1());
|
||||||
}
|
}
|
||||||
|
|
||||||
emit dataChanged(index, index);
|
emit dataChanged(index, index);
|
||||||
|
@ -330,7 +330,7 @@ RBScene* ParseTreeModel::render(ProjectModel* project,
|
||||||
|
|
||||||
if(sbsModel)
|
if(sbsModel)
|
||||||
sbsModel->deleteLater();
|
sbsModel->deleteLater();
|
||||||
sbsModel = new ParseTreeModel(QString(sbs.readAll()).toAscii());
|
sbsModel = new ParseTreeModel(QString(sbs.readAll()).toLatin1());
|
||||||
|
|
||||||
if(sbsModel->root != 0)
|
if(sbsModel->root != 0)
|
||||||
{
|
{
|
||||||
|
@ -391,7 +391,7 @@ void ParseTreeModel::setChildrenUnselectable(QGraphicsItem *root)
|
||||||
root->setFlag(QGraphicsItem::ItemIsSelectable, false);
|
root->setFlag(QGraphicsItem::ItemIsSelectable, false);
|
||||||
root->setFlag(QGraphicsItem::ItemIsMovable, false);
|
root->setFlag(QGraphicsItem::ItemIsMovable, false);
|
||||||
|
|
||||||
QList<QGraphicsItem*> children = root->children();
|
QList<QGraphicsItem*> children = root->childItems();
|
||||||
for(QList<QGraphicsItem*>::iterator i = children.begin()
|
for(QList<QGraphicsItem*>::iterator i = children.begin()
|
||||||
; i != children.end(); i++)
|
; i != children.end(); i++)
|
||||||
setChildrenUnselectable(*i);
|
setChildrenUnselectable(*i);
|
||||||
|
|
|
@ -8,7 +8,7 @@ CONFIG(debug) {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Adding network support
|
# Adding network support
|
||||||
QT += network
|
QT += network widgets
|
||||||
|
|
||||||
# Enabling profiling
|
# Enabling profiling
|
||||||
QMAKE_CXXFLAGS_DEBUG += -pg
|
QMAKE_CXXFLAGS_DEBUG += -pg
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue