diff options
author | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2020-09-03 18:33:12 +0200 |
---|---|---|
committer | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2020-09-03 18:45:48 +0200 |
commit | fa330c109dcf3399b5fdc27b188c0bafbb6e6016 (patch) | |
tree | e9e96d7f507404e4936ef681f03630aa1e3affae | |
parent | ff38666a19b09169b1a7cf1f0eda20374bc390de (diff) | |
download | rockbox-fa330c109dcf3399b5fdc27b188c0bafbb6e6016.tar.gz rockbox-fa330c109dcf3399b5fdc27b188c0bafbb6e6016.zip |
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
-rw-r--r-- | utils/themeeditor/graphics/rbscreen.cpp | 8 | ||||
-rw-r--r-- | utils/themeeditor/gui/configdocument.cpp | 10 | ||||
-rw-r--r-- | utils/themeeditor/gui/editorwindow.cpp | 2 | ||||
-rw-r--r-- | utils/themeeditor/gui/preferencesdialog.cpp | 6 | ||||
-rw-r--r-- | utils/themeeditor/gui/projectexporter.cpp | 2 | ||||
-rw-r--r-- | utils/themeeditor/gui/skindocument.cpp | 16 | ||||
-rw-r--r-- | utils/themeeditor/gui/skinhighlighter.cpp | 14 | ||||
-rw-r--r-- | utils/themeeditor/main.cpp | 2 | ||||
-rw-r--r-- | utils/themeeditor/models/parsetreemodel.cpp | 8 | ||||
-rw-r--r-- | utils/themeeditor/themeeditor.pro | 2 |
10 files changed, 35 insertions, 35 deletions
diff --git a/utils/themeeditor/graphics/rbscreen.cpp b/utils/themeeditor/graphics/rbscreen.cpp index b01552cc44..2e814a084f 100644 --- a/utils/themeeditor/graphics/rbscreen.cpp +++ b/utils/themeeditor/graphics/rbscreen.cpp | |||
@@ -227,7 +227,7 @@ void RBScreen::makeCustomUI(QString id) | |||
227 | 227 | ||
228 | void RBScreen::endSbsRender() | 228 | void RBScreen::endSbsRender() |
229 | { | 229 | { |
230 | sbsChildren = children(); | 230 | sbsChildren = childItems(); |
231 | 231 | ||
232 | QList<int> keys = fonts.keys(); | 232 | QList<int> keys = fonts.keys(); |
233 | for(QList<int>::iterator i = keys.begin(); i != keys.end(); i++) | 233 | for(QList<int>::iterator i = keys.begin(); i != keys.end(); i++) |
@@ -259,7 +259,7 @@ QColor RBScreen::stringToColor(QString str, QColor fallback) | |||
259 | { | 259 | { |
260 | for(int i = 0; i < 6; i++) | 260 | for(int i = 0; i < 6; i++) |
261 | { | 261 | { |
262 | char c = str[i].toAscii(); | 262 | char c = str[i].toLatin1(); |
263 | if(!((c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F') || | 263 | if(!((c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F') || |
264 | isdigit(c))) | 264 | isdigit(c))) |
265 | { | 265 | { |
@@ -274,9 +274,9 @@ QColor RBScreen::stringToColor(QString str, QColor fallback) | |||
274 | } | 274 | } |
275 | else if(str.length() == 1) | 275 | else if(str.length() == 1) |
276 | { | 276 | { |
277 | if(isdigit(str[0].toAscii()) && str[0].toAscii() <= '3') | 277 | if(isdigit(str[0].toLatin1()) && str[0].toLatin1() <= '3') |
278 | { | 278 | { |
279 | int shade = 255 * (str[0].toAscii() - '0') / 3; | 279 | int shade = 255 * (str[0].toLatin1() - '0') / 3; |
280 | retval = QColor(shade, shade, shade); | 280 | retval = QColor(shade, shade, shade); |
281 | } | 281 | } |
282 | else | 282 | else |
diff --git a/utils/themeeditor/gui/configdocument.cpp b/utils/themeeditor/gui/configdocument.cpp index aaea3aa1e2..0083899770 100644 --- a/utils/themeeditor/gui/configdocument.cpp +++ b/utils/themeeditor/gui/configdocument.cpp | |||
@@ -143,7 +143,7 @@ void ConfigDocument::save() | |||
143 | } | 143 | } |
144 | 144 | ||
145 | fout.open(QFile::WriteOnly); | 145 | fout.open(QFile::WriteOnly); |
146 | fout.write(toPlainText().toAscii()); | 146 | fout.write(toPlainText().toLatin1()); |
147 | fout.close(); | 147 | fout.close(); |
148 | 148 | ||
149 | saved = toPlainText(); | 149 | saved = toPlainText(); |
@@ -174,7 +174,7 @@ void ConfigDocument::saveAs() | |||
174 | 174 | ||
175 | QFile fout(filePath); | 175 | QFile fout(filePath); |
176 | fout.open(QFile::WriteOnly); | 176 | fout.open(QFile::WriteOnly); |
177 | fout.write(toPlainText().toAscii()); | 177 | fout.write(toPlainText().toLatin1()); |
178 | fout.close(); | 178 | fout.close(); |
179 | 179 | ||
180 | saved = toPlainText(); | 180 | saved = toPlainText(); |
@@ -415,14 +415,14 @@ void ConfigDocument::settingsChanged() | |||
415 | QSettings settings; | 415 | QSettings settings; |
416 | settings.beginGroup("SkinDocument"); | 416 | settings.beginGroup("SkinDocument"); |
417 | 417 | ||
418 | QColor fg = settings.value("fgColor", Qt::black).value<QColor>(); | 418 | QColor fg = settings.value("fgColor", QColor(Qt::black)).value<QColor>(); |
419 | QColor bg = settings.value("bgColor", Qt::white).value<QColor>(); | 419 | QColor bg = settings.value("bgColor", QColor(Qt::white)).value<QColor>(); |
420 | QPalette palette; | 420 | QPalette palette; |
421 | palette.setColor(QPalette::All, QPalette::Base, bg); | 421 | palette.setColor(QPalette::All, QPalette::Base, bg); |
422 | palette.setColor(QPalette::All, QPalette::Text, fg); | 422 | palette.setColor(QPalette::All, QPalette::Text, fg); |
423 | editor->setPalette(palette); | 423 | editor->setPalette(palette); |
424 | 424 | ||
425 | QColor highlight = settings.value("errorColor", Qt::red).value<QColor>(); | 425 | QColor highlight = settings.value("errorColor", QColor(Qt::red)).value<QColor>(); |
426 | editor->setErrorColor(highlight); | 426 | editor->setErrorColor(highlight); |
427 | 427 | ||
428 | /* Setting the font */ | 428 | /* Setting the font */ |
diff --git a/utils/themeeditor/gui/editorwindow.cpp b/utils/themeeditor/gui/editorwindow.cpp index 71b0c07405..89c9d670aa 100644 --- a/utils/themeeditor/gui/editorwindow.cpp +++ b/utils/themeeditor/gui/editorwindow.cpp | |||
@@ -874,7 +874,7 @@ void EditorWindow::createFile(QString filename, QString contents) | |||
874 | QFile fout(filename); | 874 | QFile fout(filename); |
875 | fout.open(QFile::WriteOnly); | 875 | fout.open(QFile::WriteOnly); |
876 | 876 | ||
877 | fout.write(contents.toAscii()); | 877 | fout.write(contents.toLatin1()); |
878 | 878 | ||
879 | fout.close(); | 879 | fout.close(); |
880 | } | 880 | } |
diff --git a/utils/themeeditor/gui/preferencesdialog.cpp b/utils/themeeditor/gui/preferencesdialog.cpp index 2c4acaee84..4ab6fdadcc 100644 --- a/utils/themeeditor/gui/preferencesdialog.cpp +++ b/utils/themeeditor/gui/preferencesdialog.cpp | |||
@@ -85,13 +85,13 @@ void PreferencesDialog::loadColors() | |||
85 | /* Buttons from the editor group */ | 85 | /* Buttons from the editor group */ |
86 | settings.beginGroup("SkinDocument"); | 86 | settings.beginGroup("SkinDocument"); |
87 | 87 | ||
88 | fgColor = settings.value("fgColor", Qt::black).value<QColor>(); | 88 | fgColor = settings.value("fgColor", QColor(Qt::black)).value<QColor>(); |
89 | setButtonColor(ui->fgButton, fgColor); | 89 | setButtonColor(ui->fgButton, fgColor); |
90 | 90 | ||
91 | bgColor = settings.value("bgColor", Qt::white).value<QColor>(); | 91 | bgColor = settings.value("bgColor", QColor(Qt::white)).value<QColor>(); |
92 | setButtonColor(ui->bgButton, bgColor); | 92 | setButtonColor(ui->bgButton, bgColor); |
93 | 93 | ||
94 | errorColor = settings.value("errorColor", Qt::red).value<QColor>(); | 94 | errorColor = settings.value("errorColor", QColor(Qt::red)).value<QColor>(); |
95 | setButtonColor(ui->errorButton, errorColor); | 95 | setButtonColor(ui->errorButton, errorColor); |
96 | 96 | ||
97 | settings.endGroup(); | 97 | settings.endGroup(); |
diff --git a/utils/themeeditor/gui/projectexporter.cpp b/utils/themeeditor/gui/projectexporter.cpp index 35fa90d060..ae47758dcf 100644 --- a/utils/themeeditor/gui/projectexporter.cpp +++ b/utils/themeeditor/gui/projectexporter.cpp | |||
@@ -204,7 +204,7 @@ void ProjectExporter::checkWPS(ProjectModel* project, QString file) | |||
204 | fin.close(); | 204 | fin.close(); |
205 | 205 | ||
206 | skin_element* root; | 206 | skin_element* root; |
207 | root = skin_parse(contents.toAscii()); | 207 | root = skin_parse(contents.toLatin1()); |
208 | if(!root) | 208 | if(!root) |
209 | { | 209 | { |
210 | addWarning(tr("Couldn't parse ") + file.split("/").last()); | 210 | addWarning(tr("Couldn't parse ") + file.split("/").last()); |
diff --git a/utils/themeeditor/gui/skindocument.cpp b/utils/themeeditor/gui/skindocument.cpp index 1ee6b6e7ee..807478807d 100644 --- a/utils/themeeditor/gui/skindocument.cpp +++ b/utils/themeeditor/gui/skindocument.cpp | |||
@@ -197,14 +197,14 @@ void SkinDocument::settingsChanged() | |||
197 | QSettings settings; | 197 | QSettings settings; |
198 | settings.beginGroup("SkinDocument"); | 198 | settings.beginGroup("SkinDocument"); |
199 | 199 | ||
200 | QColor fg = settings.value("fgColor", Qt::black).value<QColor>(); | 200 | QColor fg = settings.value("fgColor", QColor(Qt::black)).value<QColor>(); |
201 | QColor bg = settings.value("bgColor", Qt::white).value<QColor>(); | 201 | QColor bg = settings.value("bgColor", QColor(Qt::white)).value<QColor>(); |
202 | QPalette palette; | 202 | QPalette palette; |
203 | palette.setColor(QPalette::All, QPalette::Base, bg); | 203 | palette.setColor(QPalette::All, QPalette::Base, bg); |
204 | palette.setColor(QPalette::All, QPalette::Text, fg); | 204 | palette.setColor(QPalette::All, QPalette::Text, fg); |
205 | editor->setPalette(palette); | 205 | editor->setPalette(palette); |
206 | 206 | ||
207 | QColor highlight = settings.value("errorColor", Qt::red).value<QColor>(); | 207 | QColor highlight = settings.value("errorColor", QColor(Qt::red)).value<QColor>(); |
208 | editor->setErrorColor(highlight); | 208 | editor->setErrorColor(highlight); |
209 | 209 | ||
210 | /* Setting the font */ | 210 | /* Setting the font */ |
@@ -227,7 +227,7 @@ void SkinDocument::cursorChanged() | |||
227 | QTextCursor line = editor->textCursor(); | 227 | QTextCursor line = editor->textCursor(); |
228 | line.movePosition(QTextCursor::StartOfLine); | 228 | line.movePosition(QTextCursor::StartOfLine); |
229 | line.movePosition(QTextCursor::EndOfLine, QTextCursor::KeepAnchor); | 229 | line.movePosition(QTextCursor::EndOfLine, QTextCursor::KeepAnchor); |
230 | skin_parse(line.selectedText().toAscii()); | 230 | skin_parse(line.selectedText().toLatin1()); |
231 | if(skin_error_line() > 0) | 231 | if(skin_error_line() > 0) |
232 | parseStatus = tr("Error on line ") + | 232 | parseStatus = tr("Error on line ") + |
233 | QString::number(line.blockNumber() + 1) | 233 | QString::number(line.blockNumber() + 1) |
@@ -263,7 +263,7 @@ void SkinDocument::codeChanged() | |||
263 | 263 | ||
264 | editor->clearErrors(); | 264 | editor->clearErrors(); |
265 | parseStatus = model->changeTree(editor->document()-> | 265 | parseStatus = model->changeTree(editor->document()-> |
266 | toPlainText().toAscii()); | 266 | toPlainText().toLatin1()); |
267 | 267 | ||
268 | treeInSync = true; | 268 | treeInSync = true; |
269 | emit antiSync(false); | 269 | emit antiSync(false); |
@@ -294,7 +294,7 @@ void SkinDocument::codeChanged() | |||
294 | rest.removeSelectedText(); | 294 | rest.removeSelectedText(); |
295 | base += skin_error_line(); | 295 | base += skin_error_line(); |
296 | 296 | ||
297 | skin_parse(doc.toPlainText().toAscii()); | 297 | skin_parse(doc.toPlainText().toLatin1()); |
298 | 298 | ||
299 | if(skin_error_line() > 0) | 299 | if(skin_error_line() > 0) |
300 | editor->addError(base + skin_error_line()); | 300 | editor->addError(base + skin_error_line()); |
@@ -338,7 +338,7 @@ void SkinDocument::save() | |||
338 | } | 338 | } |
339 | 339 | ||
340 | fout.open(QFile::WriteOnly); | 340 | fout.open(QFile::WriteOnly); |
341 | fout.write(editor->document()->toPlainText().toAscii()); | 341 | fout.write(editor->document()->toPlainText().toLatin1()); |
342 | fout.close(); | 342 | fout.close(); |
343 | 343 | ||
344 | saved = editor->document()->toPlainText(); | 344 | saved = editor->document()->toPlainText(); |
@@ -372,7 +372,7 @@ void SkinDocument::saveAs() | |||
372 | 372 | ||
373 | QFile fout(fileName); | 373 | QFile fout(fileName); |
374 | fout.open(QFile::WriteOnly); | 374 | fout.open(QFile::WriteOnly); |
375 | fout.write(editor->document()->toPlainText().toAscii()); | 375 | fout.write(editor->document()->toPlainText().toLatin1()); |
376 | fout.close(); | 376 | fout.close(); |
377 | 377 | ||
378 | saved = editor->document()->toPlainText(); | 378 | saved = editor->document()->toPlainText(); |
diff --git a/utils/themeeditor/gui/skinhighlighter.cpp b/utils/themeeditor/gui/skinhighlighter.cpp index 92475dc5fd..9236cce2b6 100644 --- a/utils/themeeditor/gui/skinhighlighter.cpp +++ b/utils/themeeditor/gui/skinhighlighter.cpp | |||
@@ -63,7 +63,7 @@ void SkinHighlighter::highlightBlock(const QString& text) | |||
63 | if(text.length() - i < 2) | 63 | if(text.length() - i < 2) |
64 | return; | 64 | return; |
65 | 65 | ||
66 | if(find_escape_character(text[i + 1].toAscii())) | 66 | if(find_escape_character(text[i + 1].toLatin1())) |
67 | { | 67 | { |
68 | /* Checking for escaped characters */ | 68 | /* Checking for escaped characters */ |
69 | 69 | ||
@@ -82,8 +82,8 @@ void SkinHighlighter::highlightBlock(const QString& text) | |||
82 | 82 | ||
83 | if(text.length() - i >= 3) | 83 | if(text.length() - i >= 3) |
84 | { | 84 | { |
85 | lookup[0] = text[i + 1].toAscii(); | 85 | lookup[0] = text[i + 1].toLatin1(); |
86 | lookup[1] = text[i + 2].toAscii(); | 86 | lookup[1] = text[i + 2].toLatin1(); |
87 | 87 | ||
88 | found = find_tag(lookup); | 88 | found = find_tag(lookup); |
89 | } | 89 | } |
@@ -96,7 +96,7 @@ void SkinHighlighter::highlightBlock(const QString& text) | |||
96 | else | 96 | else |
97 | { | 97 | { |
98 | lookup[1] = '\0'; | 98 | lookup[1] = '\0'; |
99 | lookup[0] = text[i + 1].toAscii(); | 99 | lookup[0] = text[i + 1].toLatin1(); |
100 | found = find_tag(lookup); | 100 | found = find_tag(lookup); |
101 | 101 | ||
102 | if(found) | 102 | if(found) |
@@ -121,8 +121,8 @@ void SkinHighlighter::highlightBlock(const QString& text) | |||
121 | 121 | ||
122 | if(text.length() - i >= 4) | 122 | if(text.length() - i >= 4) |
123 | { | 123 | { |
124 | lookup[0] = text[i + 2].toAscii(); | 124 | lookup[0] = text[i + 2].toLatin1(); |
125 | lookup[1] = text[i + 3].toAscii(); | 125 | lookup[1] = text[i + 3].toLatin1(); |
126 | 126 | ||
127 | found = find_tag(lookup); | 127 | found = find_tag(lookup); |
128 | } | 128 | } |
@@ -135,7 +135,7 @@ void SkinHighlighter::highlightBlock(const QString& text) | |||
135 | else | 135 | else |
136 | { | 136 | { |
137 | lookup[1] = '\0'; | 137 | lookup[1] = '\0'; |
138 | lookup[0] = text[i + 2].toAscii(); | 138 | lookup[0] = text[i + 2].toLatin1(); |
139 | 139 | ||
140 | found = find_tag(lookup); | 140 | found = find_tag(lookup); |
141 | 141 | ||
diff --git a/utils/themeeditor/main.cpp b/utils/themeeditor/main.cpp index 5dc52a0b88..1a082759e7 100644 --- a/utils/themeeditor/main.cpp +++ b/utils/themeeditor/main.cpp | |||
@@ -21,7 +21,7 @@ | |||
21 | 21 | ||
22 | #include "editorwindow.h" | 22 | #include "editorwindow.h" |
23 | 23 | ||
24 | #include <QtGui/QApplication> | 24 | #include <QApplication> |
25 | 25 | ||
26 | int main(int argc, char* argv[]) | 26 | int main(int argc, char* argv[]) |
27 | { | 27 | { |
diff --git a/utils/themeeditor/models/parsetreemodel.cpp b/utils/themeeditor/models/parsetreemodel.cpp index 37ec9b01da..cc1e9777bd 100644 --- a/utils/themeeditor/models/parsetreemodel.cpp +++ b/utils/themeeditor/models/parsetreemodel.cpp | |||
@@ -242,7 +242,7 @@ bool ParseTreeModel::setData(const QModelIndex &index, const QVariant &value, | |||
242 | free(param->data.text); | 242 | free(param->data.text); |
243 | 243 | ||
244 | param->type = skin_tag_parameter::STRING; | 244 | param->type = skin_tag_parameter::STRING; |
245 | param->data.text = strdup(value.toString().trimmed().toAscii()); | 245 | param->data.text = strdup(value.toString().trimmed().toLatin1()); |
246 | } | 246 | } |
247 | else if(tolower(param->type_code) == 'i') | 247 | else if(tolower(param->type_code) == 'i') |
248 | { | 248 | { |
@@ -265,7 +265,7 @@ bool ParseTreeModel::setData(const QModelIndex &index, const QVariant &value, | |||
265 | return false; | 265 | return false; |
266 | 266 | ||
267 | free(element->data); | 267 | free(element->data); |
268 | element->data = strdup(value.toString().trimmed().toAscii()); | 268 | element->data = strdup(value.toString().trimmed().toLatin1()); |
269 | } | 269 | } |
270 | 270 | ||
271 | emit dataChanged(index, index); | 271 | emit dataChanged(index, index); |
@@ -330,7 +330,7 @@ RBScene* ParseTreeModel::render(ProjectModel* project, | |||
330 | 330 | ||
331 | if(sbsModel) | 331 | if(sbsModel) |
332 | sbsModel->deleteLater(); | 332 | sbsModel->deleteLater(); |
333 | sbsModel = new ParseTreeModel(QString(sbs.readAll()).toAscii()); | 333 | sbsModel = new ParseTreeModel(QString(sbs.readAll()).toLatin1()); |
334 | 334 | ||
335 | if(sbsModel->root != 0) | 335 | if(sbsModel->root != 0) |
336 | { | 336 | { |
@@ -391,7 +391,7 @@ void ParseTreeModel::setChildrenUnselectable(QGraphicsItem *root) | |||
391 | root->setFlag(QGraphicsItem::ItemIsSelectable, false); | 391 | root->setFlag(QGraphicsItem::ItemIsSelectable, false); |
392 | root->setFlag(QGraphicsItem::ItemIsMovable, false); | 392 | root->setFlag(QGraphicsItem::ItemIsMovable, false); |
393 | 393 | ||
394 | QList<QGraphicsItem*> children = root->children(); | 394 | QList<QGraphicsItem*> children = root->childItems(); |
395 | for(QList<QGraphicsItem*>::iterator i = children.begin() | 395 | for(QList<QGraphicsItem*>::iterator i = children.begin() |
396 | ; i != children.end(); i++) | 396 | ; i != children.end(); i++) |
397 | setChildrenUnselectable(*i); | 397 | setChildrenUnselectable(*i); |
diff --git a/utils/themeeditor/themeeditor.pro b/utils/themeeditor/themeeditor.pro index a7db28c7e9..b7795555d3 100644 --- a/utils/themeeditor/themeeditor.pro +++ b/utils/themeeditor/themeeditor.pro | |||
@@ -8,7 +8,7 @@ CONFIG(debug) { | |||
8 | } | 8 | } |
9 | 9 | ||
10 | # Adding network support | 10 | # Adding network support |
11 | QT += network | 11 | QT += network widgets |
12 | 12 | ||
13 | # Enabling profiling | 13 | # Enabling profiling |
14 | QMAKE_CXXFLAGS_DEBUG += -pg | 14 | QMAKE_CXXFLAGS_DEBUG += -pg |