Ilia Kats has proposed merging lp:~ilia-kats/kcm-gtk/gtk3 into lp:kcm-gtk.
Requested reviews:
Kubuntu Packagers (kubuntu-packagers)
For more details, see:
https://code.launchpad.net/~ilia-kats/kcm-gtk/gtk3/+merge/84502
* Add GTK3 support (#863174)
* Allow to deselect the XCursor theme, returning to the default (however,
changing the cursor only works in some GTK apps)
--
https://code.launchpad.net/~ilia-kats/kcm-gtk/gtk3/+merge/84502
Your team Kubuntu Packagers is requested to review the proposed merge of
lp:~ilia-kats/kcm-gtk/gtk3 into lp:kcm-gtk.
=== modified file 'src/gtkrcfile.cpp'
--- src/gtkrcfile.cpp 2010-01-11 17:33:13 +0000
+++ src/gtkrcfile.cpp 2011-12-05 16:56:29 +0000
@@ -142,7 +142,8 @@
stream << "\n";
stream << "gtk-theme-name=\"" << m_themeName << "\"\n";
stream << "gtk-font-name=\"" << fontName << "\"\n";
- stream << "gtk-cursor-theme-name = \"" << m_cursorName << "\"\n";
+ if (!m_cursorName.isEmpty())
+ stream << "gtk-cursor-theme-name = \"" << m_cursorName << "\"\n";
}
void GtkRcFile::setFont(const QString& family, int pointSize, bool bold, bool italic)
=== modified file 'src/kcmgtk.cpp'
--- src/kcmgtk.cpp 2010-01-11 17:33:13 +0000
+++ src/kcmgtk.cpp 2011-12-05 16:56:29 +0000
@@ -37,6 +37,7 @@
const QString KcmGtk::k_gtkRcFileName(QDir::homePath() + "/.gtkrc-2.0-kde4");
+const QString KcmGtk::k_gtk3RcFileName(QDir::homePath() + "/.config/gtk-3.0/settings.ini");
const QString KcmGtk::k_qtThemeName("Qt4");
const QString KcmGtk::k_qtcurveThemeName("QtCurve");
@@ -51,9 +52,11 @@
connect(m_ui.fontChange, SIGNAL(clicked()), SLOT(fontChangeClicked()));
connect(m_ui.fontKde, SIGNAL(clicked(bool)), SLOT(fontKdeClicked()));
connect(m_ui.styleBox, SIGNAL(activated(int)), SLOT(styleChanged()));
+ connect(m_ui.style3Box, SIGNAL(activated(int)), SLOT(style3Changed()));
connect(m_ui.cursorBox, SIGNAL(activated(int)), SLOT(cursorChanged()));
m_gtkRc = new GtkRcFile(k_gtkRcFileName);
+ m_gtk3Rc = new KConfigGroup(KSharedConfig::openConfig(k_gtk3RcFileName, KConfig::SimpleConfig), "Settings");
m_searchPaths = new SearchPaths(this);
connect(m_searchPaths, SIGNAL(accepted()), SLOT(getInstalledThemes()));
@@ -82,6 +85,7 @@
KcmGtk::~KcmGtk()
{
delete m_gtkRc;
+ delete m_gtk3Rc;
}
void KcmGtk::load()
@@ -92,7 +96,11 @@
checkQtCurve();
m_ui.styleBox->setCurrentIndex(m_themes.keys().indexOf(m_gtkRc->themeName()));
- m_ui.cursorBox->setCurrentIndex(m_cursors.keys().indexOf(m_gtkRc->cursorName()));
+ m_ui.style3Box->setCurrentIndex(m_gtk3themes.indexOf(m_gtk3Rc->readEntry("gtk-theme-name")));
+ if (m_gtkRc->cursorName().isEmpty())
+ m_ui.cursorBox->setCurrentIndex(0);
+ else
+ m_ui.cursorBox->setCurrentIndex(m_cursors.keys().indexOf(m_gtkRc->cursorName()) + 1);
QFont defaultFont;
bool usingKdeFont = (m_gtkRc->font().family() == defaultFont.family() &&
@@ -115,6 +123,18 @@
{
// Write ~/.gtkrc-2.0-kde4
m_gtkRc->save();
+ const QFont & font = m_gtkRc->font();
+ QString fontName = font.family() + ' ' +
+ QLatin1String(font.bold() ? "Bold " : "") +
+ QLatin1String(font.italic() ? "Italic " : "") +
+ QString::number(font.pointSize());
+ m_gtk3Rc->writeEntry("gtk-theme-name", m_ui.style3Box->currentText());
+ m_gtk3Rc->writeEntry("gtk-font-name", fontName);
+ if (!m_gtk3Rc->cursorName().isEmpty())
+ m_gtk3Rc->writeEntry("gtk-cursor-theme-name", m_gtkRc->cursorName());#
+ else
+ m_gtk3Rc->deleteEntry("gtk-cursor-theme-name");
+ m_gtk3Rc->sync();
}
void KcmGtk::defaults()
@@ -152,6 +172,7 @@
}
m_ui.cursorBox->clear();
+ m_ui.cursorBox->addItem(i18n("Use default cursor"));
m_ui.cursorBox->addItems(m_cursors.keys());
}
@@ -165,16 +186,16 @@
{
if (subdir.startsWith('.'))
continue;
- if (m_themes.contains(subdir))
- continue;
- if (!QFile::exists(path + subdir + "/gtk-2.0/gtkrc"))
- continue;
- m_themes[subdir] = path + subdir + "/gtk-2.0/gtkrc";
+ if (!m_themes.contains(subdir) && QFile::exists(path + subdir + "/gtk-2.0/gtkrc"))
+ m_themes[subdir] = path + subdir + "/gtk-2.0/gtkrc";
+ if (!m_gtk3themes.contains(subdir) && QFile::exists(path + subdir + "/gtk-3.0/gtk.css"))
+ m_gtk3themes.append(subdir);
}
}
m_ui.styleBox->clear();
m_ui.styleBox->addItems(m_themes.keys());
+ m_ui.style3Box->addItems(m_gtk3themes);
}
void KcmGtk::fontChangeClicked()
@@ -198,7 +219,10 @@
void KcmGtk::cursorChanged()
{
- m_gtkRc->setCursor(m_cursors[m_ui.cursorBox->currentText()]);
+ if (m_ui.cursorBox->currentIndex() != 0)
+ m_gtkRc->setCursor(m_cursors[m_ui.cursorBox->currentText()]);
+ else
+ m_gtkRc->setCursor(QLatin1String(""));
changed(true);
}
@@ -209,6 +233,11 @@
changed(true);
}
+void KcmGtk::style3Changed()
+{
+ changed(true);
+}
+
void KcmGtk::checkQtCurve()
{
if (m_gtkRc->themeName() == k_qtcurveThemeName)
=== modified file 'src/kcmgtk.h'
--- src/kcmgtk.h 2010-01-11 17:33:13 +0000
+++ src/kcmgtk.h 2011-12-05 16:56:29 +0000
@@ -27,7 +27,7 @@
#include "ui_kcmgtkwidget.h"
-class KConfig;
+class KConfigGroup;
class GtkRcFile;
class SearchPaths;
@@ -46,6 +46,7 @@
void fontChangeClicked();
void fontKdeClicked();
void styleChanged();
+ void style3Changed();
void cursorChanged();
void getInstalledThemes();
void getInstalledCursors();
@@ -57,11 +58,14 @@
Ui_KcmGtkWidget m_ui;
GtkRcFile* m_gtkRc;
+ KConfigGroup* m_gtk3Rc;
QMap<QString, QString> m_themes;
+ QList<QString> m_gtk3themes;
QMap<QString, QString> m_cursors;
SearchPaths* m_searchPaths;
static const QString k_gtkRcFileName;
+ static const QString k_gtk3RcFileName;
static const QString k_envFileName;
static const QString k_qtThemeName;
static const QString k_qtcurveThemeName;
=== modified file 'src/kcmgtkwidget.ui'
--- src/kcmgtkwidget.ui 2010-01-11 17:15:59 +0000
+++ src/kcmgtkwidget.ui 2011-12-05 16:56:29 +0000
@@ -20,7 +20,7 @@
<string>GTK+ Styles</string>
</property>
<layout class="QGridLayout" name="gridLayout">
- <item row="0" column="0" rowspan="4">
+ <item row="0" column="0" rowspan="5">
<layout class="QVBoxLayout">
<item>
<widget class="QLabel" name="styleIcon"/>
@@ -43,7 +43,7 @@
<item row="0" column="2">
<widget class="QLabel" name="label">
<property name="text">
- <string>&Widget style:</string>
+ <string>GTK+2 &Widget style:</string>
</property>
<property name="buddy">
<cstring>styleBox</cstring>
@@ -66,14 +66,14 @@
</property>
</spacer>
</item>
- <item row="3" column="2" colspan="2">
+ <item row="4" column="2" colspan="2">
<widget class="QPushButton" name="warning3">
<property name="text">
<string>Change search paths...</string>
</property>
</widget>
</item>
- <item row="3" column="5">
+ <item row="4" column="5">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
@@ -86,7 +86,7 @@
</property>
</spacer>
</item>
- <item row="1" column="2">
+ <item row="2" column="2">
<widget class="QLabel" name="label_2">
<property name="text">
<string>&Cursor Style:</string>
@@ -96,11 +96,37 @@
</property>
</widget>
</item>
- <item row="1" column="3">
+ <item row="2" column="3">
<widget class="KComboBox" name="cursorBox"/>
</item>
+ <item row="2" column="5">
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="1" column="2">
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>GTK+3 Widget &style</string>
+ </property>
+ <property name="buddy">
+ <cstring>style3Box</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="3">
+ <widget class="KComboBox" name="style3Box"/>
+ </item>
<item row="1" column="5">
- <spacer name="horizontalSpacer">
+ <spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@@ -189,7 +215,7 @@
<item row="3" column="1" colspan="3">
<widget class="KSqueezedTextLabel" name="qtcurveFontLabel">
<property name="text">
- <string>The QtCurve widget theme uses your KDE font settings</string>
+ <string>KSqueezedTextLabel</string>
</property>
<property name="indent">
<number>32</number>
@@ -232,6 +258,11 @@
</widget>
<customwidgets>
<customwidget>
+ <class>KComboBox</class>
+ <extends>QComboBox</extends>
+ <header>kcombobox.h</header>
+ </customwidget>
+ <customwidget>
<class>KSqueezedTextLabel</class>
<extends>QLabel</extends>
<header>ksqueezedtextlabel.h</header>
--
kubuntu-devel mailing list
[email protected]
Modify settings or unsubscribe at:
https://lists.ubuntu.com/mailman/listinfo/kubuntu-devel