A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita audio rust zig deno mpris rockbox mpd
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

Theme Editor: Made auto-complete functional and enabled it by default. Added a small subset of the available tags to the tagdb file, filling it out is todo

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27625 a1c6a512-1295-4272-9138-f99709370657

+174 -27
+52 -7
utils/themeeditor/gui/codeeditor.cpp
··· 107 107 /* Closing the completer if the cursor has moved out of its bounds */ 108 108 if(completer.isVisible()) 109 109 { 110 + if(document()->toPlainText().length() > docLength) 111 + tagEnd++; 112 + else if(document()->toPlainText().length() < docLength) 113 + tagEnd--; 114 + 110 115 if(textCursor().position() < tagBegin 111 116 || textCursor().position() > tagEnd) 112 117 { ··· 115 120 } 116 121 } 117 122 123 + void CodeEditor::insertTag() 124 + { 125 + /* Clearing the typed tag and inserting one from the completer */ 126 + QTextCursor at(document()); 127 + at.setPosition(tagBegin, QTextCursor::MoveAnchor); 128 + while(document()->characterAt(at.position()) == QChar('%') 129 + || document()->characterAt(at.position()) == '?') 130 + at.movePosition(QTextCursor::NextCharacter, QTextCursor::MoveAnchor, 1); 131 + 132 + at.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor, 133 + tagEnd - at.position()); 134 + at.removeSelectedText(); 135 + 136 + at.insertText(completer.currentItem()->text(0)); 137 + 138 + completer.hide(); 139 + } 140 + 118 141 //![resizeEvent] 119 142 120 143 void CodeEditor::resizeEvent(QResizeEvent *e) ··· 131 154 void CodeEditor::keyPressEvent(QKeyEvent *event) 132 155 { 133 156 134 - if(!settings.value("completeSyntax", false).toBool()) 157 + if(!settings.value("completeSyntax", true).toBool()) 135 158 { 136 159 QPlainTextEdit::keyPressEvent(event); 137 160 return; ··· 154 177 < completer.topLevelItemCount() - 1) 155 178 QApplication::sendEvent(&completer, event); 156 179 } 157 - else if(event->key() == Qt::Key_Backspace) 180 + else if(event->key() == Qt::Key_Backspace 181 + || event->key() == Qt::Key_Delete) 158 182 { 159 - tagEnd--; 183 + docLength = document()->toPlainText().length(); 160 184 QPlainTextEdit::keyPressEvent(event); 185 + 186 + QString filterText; 187 + 188 + for(int i = tagBegin; i < tagEnd; i++) 189 + { 190 + QChar c = document()->characterAt(i); 191 + if(c != '%' && c != '?') 192 + filterText.append(c); 193 + } 194 + 195 + completer.filter(filterText); 161 196 } 162 197 else if(event->key() == Qt::Key_Escape) 163 198 { ··· 165 200 completer.hide(); 166 201 QPlainTextEdit::keyPressEvent(event); 167 202 } 168 - else if(event->key() == Qt::Key_Enter) 203 + else if(event->key() == Qt::Key_Return) 169 204 { 170 205 /* The enter key inserts the currently selected tag */ 206 + insertTag(); 171 207 } 172 208 else if(event->key() == Qt::Key_Question) 173 209 { 174 210 /* The question mark doesn't filter the list */ 175 - tagEnd++; 211 + docLength = document()->toPlainText().length(); 176 212 QPlainTextEdit::keyPressEvent(event); 177 213 } 178 214 else if(event->key() == Qt::Key_Left ··· 184 220 else 185 221 { 186 222 /* Otherwise, we have to filter the list */ 187 - tagEnd++; 223 + docLength = document()->toPlainText().length(); 188 224 QPlainTextEdit::keyPressEvent(event); 189 225 190 - QString filterText = ""; 226 + QString filterText; 227 + 228 + for(int i = tagBegin; i < tagEnd; i++) 229 + { 230 + QChar c = document()->characterAt(i); 231 + if(c != '%' && c != '?') 232 + filterText.append(c); 233 + } 234 + 235 + completer.filter(filterText); 191 236 } 192 237 } 193 238 else
+2
utils/themeeditor/gui/codeeditor.h
··· 77 77 void updateLineNumberAreaWidth(int newBlockCount); 78 78 void updateLineNumberArea(const QRect &, int); 79 79 void cursorMoved(); 80 + void insertTag(); 80 81 81 82 private: 82 83 QWidget *lineNumberArea; ··· 87 88 88 89 int tagBegin; 89 90 int tagEnd; 91 + int docLength; 90 92 }; 91 93 92 94 //![codeeditordefinition]
+1 -1
utils/themeeditor/gui/preferencesdialog.cpp
··· 51 51 QSettings settings; 52 52 settings.beginGroup("CodeEditor"); 53 53 ui->completionBox->setChecked(settings.value("completeSyntax", 54 - false).toBool()); 54 + true).toBool()); 55 55 settings.endGroup(); 56 56 } 57 57
+3
utils/themeeditor/gui/preferencesdialog.ui
··· 68 68 <property name="text"> 69 69 <string>Enable Syntax Completion</string> 70 70 </property> 71 + <property name="checked"> 72 + <bool>true</bool> 73 + </property> 71 74 </widget> 72 75 </item> 73 76 </layout>
+17 -8
utils/themeeditor/gui/syntaxcompleter.cpp
··· 23 23 #include <QTreeWidgetItem> 24 24 25 25 #include "syntaxcompleter.h" 26 + #include "codeeditor.h" 26 27 27 - SyntaxCompleter::SyntaxCompleter(QWidget *parent) : 28 + SyntaxCompleter::SyntaxCompleter(CodeEditor *parent) : 28 29 QTreeWidget(parent) 29 30 { 30 31 setHeaderHidden(true); 32 + setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded); 31 33 32 34 setWordWrap(true); 33 35 setColumnCount(2); 36 + 37 + QObject::connect(this, SIGNAL(activated(QModelIndex)), 38 + parent, SLOT(insertTag())); 34 39 35 40 QFile fin(":/resources/tagdb"); 36 41 fin.open(QFile::ReadOnly | QFile::Text); ··· 45 50 QStringList tag; 46 51 tag.append(split[0].trimmed()); 47 52 tag.append(split[1].trimmed()); 48 - tags.insert(split[0].trimmed().toLower(), tag); 53 + tags.insertMulti(split[0].trimmed().toLower(), tag); 49 54 } 50 55 51 56 filter(""); 52 - 53 - resizeColumnToContents(0); 54 - setColumnWidth(0, columnWidth(0) + 10); // Auto-resize is too small 55 57 56 58 } 57 59 ··· 64 66 { 65 67 if(text.length() == 1) 66 68 { 67 - if(text[0].toLower() != i.key()[0]) 69 + if(text[0].toLower() != i.key()[0].toLower()) 68 70 continue; 69 71 } 70 72 else if(text.length() == 2) 71 73 { 72 - if(text[0].toLower() != i.key()[0] || i.key().length() < 2 73 - || text[1].toLower() != i.key()[1]) 74 + if(text[0].toLower() != i.key()[0].toLower() || i.key().length() < 2 75 + || text[1].toLower() != i.key()[1].toLower()) 74 76 continue; 75 77 } 76 78 else if(text.length() > 2) ··· 80 82 81 83 addTopLevelItem(new QTreeWidgetItem(i.value())); 82 84 } 85 + 86 + if(topLevelItemCount() > 0) 87 + setCurrentIndex(indexFromItem(topLevelItem(0))); 88 + 89 + resizeColumnToContents(0); 90 + setColumnWidth(0, columnWidth(0) + 10); // Auto-resize is too small 91 + resizeColumnToContents(1); 83 92 }
+3 -1
utils/themeeditor/gui/syntaxcompleter.h
··· 24 24 25 25 #include <QTreeWidget> 26 26 27 + class CodeEditor; 28 + 27 29 class SyntaxCompleter : public QTreeWidget 28 30 { 29 31 Q_OBJECT 30 32 public: 31 - SyntaxCompleter(QWidget *parent = 0); 33 + SyntaxCompleter(CodeEditor *parent = 0); 32 34 void filter(QString text); 33 35 34 36 signals:
+20
utils/themeeditor/resources/deviceoptions
··· 1 + ########################################################################### 2 + # __________ __ ___. 3 + # Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + # \/ \/ \/ \/ \/ 8 + # $Id$ 9 + # 10 + # Copyright (C) 2010 Robert Bieber 11 + # 12 + # This program is free software; you can redistribute it and/or 13 + # modify it under the terms of the GNU General Public License 14 + # as published by the Free Software Foundation; either version 2 15 + # of the License, or (at your option) any later version. 16 + # 17 + # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 18 + # KIND, either express or implied. 19 + # 20 + ############################################################################/ 1 21 # This file defines the options for the device configuration panel 2 22 # Declare a section with a line containing a string inside brackets, i.e. 3 23 # [Some Section]
+76 -10
utils/themeeditor/resources/tagdb
··· 1 - z : Ending tag 2 - aa : Should come at the beginning of everything 3 - za : Should come after z 4 - y : Should come before z 5 - T : Test tag 1 6 - Ta : Test tag 2 7 - Tb : Test tag 3 8 - U : Another test 9 - Ua : Yet another test 10 - Uc : A sixth test 1 + ########################################################################### 2 + # __________ __ ___. 3 + # Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + # \/ \/ \/ \/ \/ 8 + # $Id$ 9 + # 10 + # Copyright (C) 2010 Robert Bieber 11 + # 12 + # This program is free software; you can redistribute it and/or 13 + # modify it under the terms of the GNU General Public License 14 + # as published by the Free Software Foundation; either version 2 15 + # of the License, or (at your option) any later version. 16 + # 17 + # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 18 + # KIND, either express or implied. 19 + # 20 + ############################################################################/ 21 + 22 + # Enter tags in the format "tag : Description" 23 + # Empty lines and lines beginning with '#' are ignored 24 + # The descriptions are going to be displayed in a little auto-complete 25 + # pop-up, so keep them as terse as possible 26 + # 27 + # Like the deviceoptions file, this is compiled into the executable and 28 + # could segfault things if improperly formatted, so be careful---treat it 29 + # like part of the source code, because it is. 30 + # 31 + 32 + # Viewport tags 33 + 34 + V : Viewport declaration 35 + Vl : Viewport preload 36 + Vd : Viewport display 37 + Vi : Custom UI viewport 38 + VI : Pick custom UI viewport 39 + Vf : Foreground color 40 + Vb : Background color 41 + 42 + # Fonts 43 + 44 + Fl : Load a font 45 + 46 + # Status Bar 47 + 48 + we : Enable status bar 49 + wd : Disable status bar 50 + wi : Display inbuilt status bar 51 + 52 + # ID3 Info 53 + ia : Artist 54 + ic : Composer 55 + iA : Album artist 56 + id : Album Name 57 + iG : Grouping 58 + in : Track # 59 + it : Track Title 60 + iC : Comment 61 + iv : ID3 version 62 + iy : ID3 year 63 + ik : Disc number 64 + 65 + # Next track ID3 66 + Ia : Next Artist 67 + Ic : Next Composer 68 + IA : Next Album artist 69 + Id : Next Album Name 70 + IG : Next Grouping 71 + In : Next Track # 72 + It : Next Track Title 73 + IC : Next Comment 74 + Iv : Next ID3 version 75 + Iy : Next ID3 year 76 + Ik : Next Disc number