forked from len0rd/rockbox
Theme Editor: Added a preferences dialog and allowed modification of the syntax highlighting and editor colors
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26640 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
fbfdaf5c79
commit
53b619c6e8
10 changed files with 563 additions and 23 deletions
|
@ -23,6 +23,7 @@
|
|||
|
||||
#include <QFile>
|
||||
#include <QSettings>
|
||||
#include <QColor>
|
||||
#include <QMessageBox>
|
||||
#include <QFileDialog>
|
||||
|
||||
|
@ -61,6 +62,14 @@ SkinDocument::~SkinDocument()
|
|||
delete model;
|
||||
}
|
||||
|
||||
void SkinDocument::connectPrefs(PreferencesDialog* prefs)
|
||||
{
|
||||
QObject::connect(prefs, SIGNAL(accepted()),
|
||||
this, SLOT(colorsChanged()));
|
||||
QObject::connect(prefs, SIGNAL(accepted()),
|
||||
highlighter, SLOT(loadSettings()));
|
||||
}
|
||||
|
||||
bool SkinDocument::requestClose()
|
||||
{
|
||||
if(editor->document()->toPlainText() != saved)
|
||||
|
@ -106,9 +115,7 @@ void SkinDocument::setupUI()
|
|||
setLayout(layout);
|
||||
|
||||
/* Attaching the syntax highlighter */
|
||||
highlighter = new SkinHighlighter(QColor(0,180,0), QColor(255,0,0),
|
||||
QColor(0,0,255), QColor(120,120,120),
|
||||
editor->document());
|
||||
highlighter = new SkinHighlighter(editor->document());
|
||||
|
||||
/* Setting up the model */
|
||||
model = new ParseTreeModel("");
|
||||
|
@ -116,6 +123,27 @@ void SkinDocument::setupUI()
|
|||
/* Connecting the editor's signal */
|
||||
QObject::connect(editor, SIGNAL(textChanged()),
|
||||
this, SLOT(codeChanged()));
|
||||
|
||||
colorsChanged();
|
||||
}
|
||||
|
||||
void SkinDocument::colorsChanged()
|
||||
{
|
||||
/* Setting the editor colors */
|
||||
QSettings settings;
|
||||
settings.beginGroup("SkinDocument");
|
||||
|
||||
QColor fg = settings.value("fgColor", Qt::black).value<QColor>();
|
||||
QColor bg = settings.value("bgColor", Qt::white).value<QColor>();
|
||||
QPalette palette;
|
||||
palette.setColor(QPalette::All, QPalette::Base, bg);
|
||||
palette.setColor(QPalette::All, QPalette::Text, fg);
|
||||
|
||||
editor->setPalette(palette);
|
||||
editor->repaint();
|
||||
|
||||
settings.endGroup();
|
||||
|
||||
}
|
||||
|
||||
void SkinDocument::codeChanged()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue