forked from len0rd/rockbox
Theme Editor: Added font selection
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26650 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
4a9398e3fc
commit
ffc1afc30d
5 changed files with 173 additions and 87 deletions
|
@ -42,6 +42,7 @@ PreferencesDialog::~PreferencesDialog()
|
||||||
void PreferencesDialog::loadSettings()
|
void PreferencesDialog::loadSettings()
|
||||||
{
|
{
|
||||||
loadColors();
|
loadColors();
|
||||||
|
loadFont();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreferencesDialog::loadColors()
|
void PreferencesDialog::loadColors()
|
||||||
|
@ -83,9 +84,25 @@ void PreferencesDialog::loadColors()
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PreferencesDialog::loadFont()
|
||||||
|
{
|
||||||
|
QSettings settings;
|
||||||
|
settings.beginGroup("SkinDocument");
|
||||||
|
|
||||||
|
QVariant family = settings.value("fontFamily", QFont());
|
||||||
|
int size = settings.value("fontSize", 12).toInt();
|
||||||
|
|
||||||
|
settings.endGroup();
|
||||||
|
|
||||||
|
ui->fontSelect->setCurrentFont(family.value<QFont>());
|
||||||
|
ui->fontSize->setValue(size);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void PreferencesDialog::saveSettings()
|
void PreferencesDialog::saveSettings()
|
||||||
{
|
{
|
||||||
saveColors();
|
saveColors();
|
||||||
|
saveFont();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreferencesDialog::saveColors()
|
void PreferencesDialog::saveColors()
|
||||||
|
@ -111,6 +128,17 @@ void PreferencesDialog::saveColors()
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PreferencesDialog::saveFont()
|
||||||
|
{
|
||||||
|
QSettings settings;
|
||||||
|
settings.beginGroup("SkinDocument");
|
||||||
|
|
||||||
|
settings.setValue("fontFamily", ui->fontSelect->currentFont());
|
||||||
|
settings.setValue("fontSize", ui->fontSize->value());
|
||||||
|
|
||||||
|
settings.endGroup();
|
||||||
|
}
|
||||||
|
|
||||||
void PreferencesDialog::setupUI()
|
void PreferencesDialog::setupUI()
|
||||||
{
|
{
|
||||||
/* Connecting color buttons */
|
/* Connecting color buttons */
|
||||||
|
|
|
@ -53,8 +53,10 @@ private:
|
||||||
|
|
||||||
void loadSettings();
|
void loadSettings();
|
||||||
void loadColors();
|
void loadColors();
|
||||||
|
void loadFont();
|
||||||
void saveSettings();
|
void saveSettings();
|
||||||
void saveColors();
|
void saveColors();
|
||||||
|
void saveFont();
|
||||||
|
|
||||||
void setupUI();
|
void setupUI();
|
||||||
|
|
||||||
|
|
|
@ -15,29 +15,56 @@
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QToolBox" name="prefsGroups">
|
<widget class="QTabWidget" name="prefsGroups">
|
||||||
|
<property name="tabPosition">
|
||||||
|
<enum>QTabWidget::West</enum>
|
||||||
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="highlighting">
|
<widget class="QWidget" name="tab_2">
|
||||||
<property name="geometry">
|
<attribute name="title">
|
||||||
<rect>
|
<string>Editor</string>
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>352</width>
|
|
||||||
<height>288</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<attribute name="label">
|
|
||||||
<string>Editor Colors</string>
|
|
||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_7">
|
||||||
|
<property name="text">
|
||||||
|
<string>Font</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QFontComboBox" name="fontSelect"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_8">
|
||||||
|
<property name="text">
|
||||||
|
<string>Size</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QSpinBox" name="fontSize">
|
||||||
|
<property name="value">
|
||||||
|
<number>12</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_2">
|
<widget class="QLabel" name="label_2">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Foreground</string>
|
<string>Foreground Color</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||||
|
@ -47,10 +74,24 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="fgButton">
|
||||||
|
<property name="autoFillBackground">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Click To Change</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_3">
|
<widget class="QLabel" name="label_3">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Background</string>
|
<string>Background Color</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||||
|
@ -60,6 +101,27 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="bgButton">
|
||||||
|
<property name="autoFillBackground">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Click To Change</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="prefsGroupsPage1" native="true">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>Highlighting</string>
|
||||||
|
</attribute>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_4">
|
<widget class="QLabel" name="label_4">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -73,69 +135,6 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_5">
|
|
||||||
<property name="text">
|
|
||||||
<string>Escaped Character</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
<property name="buddy">
|
|
||||||
<cstring>escapedButton</cstring>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_6">
|
|
||||||
<property name="text">
|
|
||||||
<string>Conditional</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
<property name="buddy">
|
|
||||||
<cstring>conditionalButton</cstring>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label">
|
|
||||||
<property name="text">
|
|
||||||
<string>Tag</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
<property name="buddy">
|
|
||||||
<cstring>tagButton</cstring>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="fgButton">
|
|
||||||
<property name="autoFillBackground">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Click To Change</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="bgButton">
|
|
||||||
<property name="autoFillBackground">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Click To Change</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="commentButton">
|
<widget class="QPushButton" name="commentButton">
|
||||||
<property name="autoFillBackground">
|
<property name="autoFillBackground">
|
||||||
|
@ -149,6 +148,23 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_5">
|
||||||
|
<property name="text">
|
||||||
|
<string>Escaped Character</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
<property name="buddy">
|
||||||
|
<cstring>escapedButton</cstring>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="escapedButton">
|
<widget class="QPushButton" name="escapedButton">
|
||||||
<property name="autoFillBackground">
|
<property name="autoFillBackground">
|
||||||
|
@ -159,6 +175,23 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_6">
|
||||||
|
<property name="text">
|
||||||
|
<string>Conditional</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
<property name="buddy">
|
||||||
|
<cstring>conditionalButton</cstring>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="conditionalButton">
|
<widget class="QPushButton" name="conditionalButton">
|
||||||
<property name="autoFillBackground">
|
<property name="autoFillBackground">
|
||||||
|
@ -169,6 +202,23 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Tag</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
<property name="buddy">
|
||||||
|
<cstring>tagButton</cstring>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="tagButton">
|
<widget class="QPushButton" name="tagButton">
|
||||||
<property name="autoFillBackground">
|
<property name="autoFillBackground">
|
||||||
|
@ -206,8 +256,8 @@
|
||||||
<slot>accept()</slot>
|
<slot>accept()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>248</x>
|
<x>257</x>
|
||||||
<y>254</y>
|
<y>360</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>157</x>
|
<x>157</x>
|
||||||
|
@ -222,8 +272,8 @@
|
||||||
<slot>reject()</slot>
|
<slot>reject()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>316</x>
|
<x>325</x>
|
||||||
<y>260</y>
|
<y>360</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>286</x>
|
<x>286</x>
|
||||||
|
|
|
@ -65,7 +65,7 @@ SkinDocument::~SkinDocument()
|
||||||
void SkinDocument::connectPrefs(PreferencesDialog* prefs)
|
void SkinDocument::connectPrefs(PreferencesDialog* prefs)
|
||||||
{
|
{
|
||||||
QObject::connect(prefs, SIGNAL(accepted()),
|
QObject::connect(prefs, SIGNAL(accepted()),
|
||||||
this, SLOT(colorsChanged()));
|
this, SLOT(settingsChanged()));
|
||||||
QObject::connect(prefs, SIGNAL(accepted()),
|
QObject::connect(prefs, SIGNAL(accepted()),
|
||||||
highlighter, SLOT(loadSettings()));
|
highlighter, SLOT(loadSettings()));
|
||||||
}
|
}
|
||||||
|
@ -124,10 +124,10 @@ void SkinDocument::setupUI()
|
||||||
QObject::connect(editor, SIGNAL(textChanged()),
|
QObject::connect(editor, SIGNAL(textChanged()),
|
||||||
this, SLOT(codeChanged()));
|
this, SLOT(codeChanged()));
|
||||||
|
|
||||||
colorsChanged();
|
settingsChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkinDocument::colorsChanged()
|
void SkinDocument::settingsChanged()
|
||||||
{
|
{
|
||||||
/* Setting the editor colors */
|
/* Setting the editor colors */
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
|
@ -140,6 +140,12 @@ void SkinDocument::colorsChanged()
|
||||||
palette.setColor(QPalette::All, QPalette::Text, fg);
|
palette.setColor(QPalette::All, QPalette::Text, fg);
|
||||||
|
|
||||||
editor->setPalette(palette);
|
editor->setPalette(palette);
|
||||||
|
|
||||||
|
/* Setting the font */
|
||||||
|
QFont family = settings.value("fontFamily", QFont()).value<QFont>();
|
||||||
|
family.setPointSize(settings.value("fontSize", 12).toInt());
|
||||||
|
editor->setFont(family);
|
||||||
|
|
||||||
editor->repaint();
|
editor->repaint();
|
||||||
|
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
|
@ -63,7 +63,7 @@ signals:
|
||||||
void titleChanged(QString);
|
void titleChanged(QString);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void colorsChanged();
|
void settingsChanged();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void codeChanged();
|
void codeChanged();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue