diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,7 +44,6 @@ src/gtkconfigkcmodule.cpp src/dialog_installer.cpp src/dialog_uninstaller.cpp - src/fontshelpers.cpp ) ki18n_wrap_ui(kcm_SRCS diff --git a/src/abstractappearance.h b/src/abstractappearance.h --- a/src/abstractappearance.h +++ b/src/abstractappearance.h @@ -42,7 +42,6 @@ void setCursor(const QString& name); void setIcon(const QString& name); void setIconFallback(const QString& name); - void setFont(const QString& font); void setShowIconsInMenus(bool show); void setShowIconsInButtons(bool show); void setPrimaryButtonWarpsSlider(bool enabled); @@ -52,7 +51,6 @@ QString getCursor() const; QString getIcon() const; QString getIconFallback() const; - QString getFont() const; QString getThemeGtk3() const; QString getToolbarStyle() const; bool getShowIconsInButtons() const; diff --git a/src/abstractappearance.cpp b/src/abstractappearance.cpp --- a/src/abstractappearance.cpp +++ b/src/abstractappearance.cpp @@ -34,7 +34,6 @@ void AbstractAppearance::setCursor(const QString& cur) { m_settings["cursor"] = cur;} void AbstractAppearance::setIcon(const QString& ic) { m_settings["icon"] = ic;} void AbstractAppearance::setIconFallback(const QString& fall) { m_settings["icon_fallback"] = fall; } -void AbstractAppearance::setFont(const QString& fo) { m_settings["font"] = fo;} void AbstractAppearance::setShowIconsInButtons(bool show) { m_settings["show_icons_buttons"] = show ? "1" : "0"; } void AbstractAppearance::setShowIconsInMenus(bool show) { m_settings["show_icons_menus"] = show ? "1" : "0"; } void AbstractAppearance::setPrimaryButtonWarpsSlider(bool enabled) { m_settings["primary_button_warps_slider"] = enabled ? "1" : "0"; } @@ -45,7 +44,6 @@ QString AbstractAppearance::getCursor() const { return m_settings["cursor"];} QString AbstractAppearance::getIcon() const { return m_settings["icon"];} QString AbstractAppearance::getIconFallback() const { return m_settings["icon_fallback"]; } -QString AbstractAppearance::getFont() const { return m_settings["font"]; } QString AbstractAppearance::getThemeGtk3() const { return m_settings["themegtk3"]; } QString AbstractAppearance::getToolbarStyle() const { return m_settings["toolbar_style"]; } bool AbstractAppearance::getShowIconsInButtons() const { return isTrue(m_settings["show_icons_buttons"]); } diff --git a/src/appearancegtk2.cpp b/src/appearancegtk2.cpp --- a/src/appearancegtk2.cpp +++ b/src/appearancegtk2.cpp @@ -49,8 +49,6 @@ m_settings["icon_fallback"] = *it; else if (it.key() == "gtk-cursor-theme-name") m_settings["cursor"] = *it; - else if (it.key() == "gtk-font-name") - m_settings["font"] = *it; else if (it.key() == "gtk-toolbar-style") m_settings["toolbar_style"] = *it; else if (it.key() == "gtk-button-images") @@ -109,7 +107,6 @@ void AppearanceGTK2::modifyGtkrcContents(QString& fileContents) const { - modifyGtkrcProperty("gtk-font-name", m_settings["font"], fileContents); modifyGtkrcProperty("gtk-theme-name", m_settings["theme"], fileContents); modifyGtkrcProperty("gtk-icon-theme-name", m_settings["icon"], fileContents); modifyGtkrcProperty("gtk-fallback-icon-theme", m_settings["icon_fallback"], fileContents); diff --git a/src/appearancegtk3.cpp b/src/appearancegtk3.cpp --- a/src/appearancegtk3.cpp +++ b/src/appearancegtk3.cpp @@ -63,7 +63,6 @@ { KConfigGroup group(file, "Settings"); - group.writeEntry("gtk-font-name", m_settings["font"]); group.writeEntry("gtk-theme-name", m_settings["theme"]); group.writeEntry("gtk-icon-theme-name", m_settings["icon"]); group.writeEntry("gtk-fallback-icon-theme", m_settings["icon_fallback"]); @@ -100,7 +99,6 @@ m_settings["icon"] = group.readEntry("gtk-icon-theme-name"); m_settings["icon_fallback"] = group.readEntry("gtk-fallback-icon-theme"); m_settings["cursor"] = group.readEntry("gtk-cursor-theme-name"); - m_settings["font"] = group.readEntry("gtk-font-name"); m_settings["toolbar_style"] = group.readEntry("gtk-toolbar-style"); m_settings["show_icons_buttons"] = group.readEntry("gtk-button-images"); m_settings["show_icons_menus"] = group.readEntry("gtk-menu-images"); @@ -169,7 +167,6 @@ g_settings_set_string(gsettings, "gtk-theme", m_settings["theme"].toUtf8().constData()); g_settings_set_string(gsettings, "icon-theme", m_settings["icon"].toUtf8().constData()); g_settings_set_string(gsettings, "cursor-theme", m_settings["cursor"].toUtf8().constData()); - g_settings_set_string(gsettings, "font-name", m_settings["font"].toUtf8().constData()); QString toolbarStyle; if (m_settings["toolbar_style"] == QStringLiteral("GTK_TOOLBAR_ICONS")) { diff --git a/src/appearencegtk.h b/src/appearencegtk.h --- a/src/appearencegtk.h +++ b/src/appearencegtk.h @@ -44,7 +44,6 @@ void setCursor(const QString&); void setIcon(const QString&); void setIconFallback(const QString&); - void setFont(const QString&); void setToolbarStyle(const QString&); void setShowIconsInMenus(const bool& show); @@ -57,7 +56,6 @@ QString getCursor() const; QString getIcon() const; - QString getFont() const; QString getIconFallback() const; QString getToolbarStyle() const; bool getShowIconsInMenus() const; diff --git a/src/appearencegtk.cpp b/src/appearencegtk.cpp --- a/src/appearencegtk.cpp +++ b/src/appearencegtk.cpp @@ -44,7 +44,6 @@ PROPERTY_IMPLEMENTATION(QString, Cursor, "cursor") PROPERTY_IMPLEMENTATION(QString, Icon, "icon") PROPERTY_IMPLEMENTATION(QString, IconFallback, "icon_fallback") -PROPERTY_IMPLEMENTATION(QString, Font, "font") PROPERTY_IMPLEMENTATION(QString, ToolbarStyle, "toolbar_style") PROPERTY_IMPLEMENTATION(bool, ShowIconsInButtons, "show_icons_buttons") PROPERTY_IMPLEMENTATION(bool, ShowIconsInMenus, "show_icons_menus") diff --git a/src/fontshelpers.h b/src/fontshelpers.h deleted file mode 100644 --- a/src/fontshelpers.h +++ /dev/null @@ -1,30 +0,0 @@ -/* KDE GTK Configuration Module - * - * Copyright 2011 Aleix Pol Gonzalez - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) version 3, or any - * later version accepted by the membership of KDE e.V. (or its - * successor approved by the membership of KDE e.V.), which shall - * act as a proxy defined in Section 6 of version 3 of the license. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - */ - -#ifndef FONTSHELPERS_H -#define FONTSHELPERS_H - -#include - -QString fontToString(const QFont& f); -QFont stringToFont(const QString& font); - -#endif diff --git a/src/fontshelpers.cpp b/src/fontshelpers.cpp deleted file mode 100644 --- a/src/fontshelpers.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/* KDE GTK Configuration Module - * - * Copyright 2011 Aleix Pol Gonzalez - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) version 3, or any - * later version accepted by the membership of KDE e.V. (or its - * successor approved by the membership of KDE e.V.), which shall - * act as a proxy defined in Section 6 of version 3 of the license. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - */ - -#include "fontshelpers.h" -#include -#include -#include -#include - -QString fontToString(const QFont& f) -{ - return f.family() + ' ' + f.styleName() + ' ' + QString::number(f.pointSize()); -} - -QFont stringToFont(const QString& font) -{ - QFontDatabase fdb; - QString fontFamily; - int familyIdx=-1; - QStringList allFamilies = fdb.families(); - for(int idx=font.indexOf(' '); idx=0; idx=font.indexOf(' ', idx+1)) { - QString testFont = font.left(idx); - if(allFamilies.contains(testFont)) { - fontFamily = testFont; - familyIdx = idx; - } - } - - QFont f; - f.setFamily(fontFamily); - QRegularExpression fontRx(QStringLiteral(" (.*) +([0-9]+)$")); - QRegularExpressionMatch match = fontRx.match(font, familyIdx); - if (match.isValid()) { - QString fontStyle = match.captured(1).trimmed(); - int fontSize = match.captured(2).toInt(); - f.setStyleName(fontStyle); - f.setPointSize(fontSize); - } else { - qWarning() << "Couldn't figure out style and size" << font; - } - return f; -} diff --git a/src/gtkconfigkcmodule.cpp b/src/gtkconfigkcmodule.cpp --- a/src/gtkconfigkcmodule.cpp +++ b/src/gtkconfigkcmodule.cpp @@ -36,7 +36,6 @@ #include "ui_gui.h" #include "abstractappearance.h" #include "iconthemesmodel.h" -#include "fontshelpers.h" #include #include #include @@ -126,7 +125,6 @@ connect(ui->cb_cursor, SIGNAL(currentIndexChanged(int)), this, SLOT(appChanged())); connect(ui->cb_icon, SIGNAL(currentIndexChanged(int)), this, SLOT(appChanged())); connect(ui->cb_icon_fallback ,SIGNAL(currentIndexChanged(int)), this, SLOT(appChanged())); - connect(ui->font, &KFontRequester::fontSelected, this, >KConfigKCModule::appChanged); connect(ui->cb_toolbar_icons, SIGNAL(currentIndexChanged(int)), this, SLOT(appChanged())); connect(ui->checkBox_icon_gtk_menus, &QAbstractButton::clicked, this, >KConfigKCModule::appChanged); connect(ui->checkBox_icon_gtk_buttons, &QAbstractButton::clicked, this, >KConfigKCModule::appChanged); @@ -169,7 +167,6 @@ appareance->setCursor(ui->cb_cursor->itemData(ui->cb_cursor->currentIndex(), CursorThemesModel::DirNameRole).toString()); appareance->setIcon(ui->cb_icon->itemData(ui->cb_icon->currentIndex(), IconThemesModel::DirNameRole).toString()); appareance->setIconFallback(ui->cb_icon_fallback->itemData(ui->cb_icon_fallback->currentIndex(), IconThemesModel::DirNameRole).toString()); - appareance->setFont(fontToString(ui->font->font())); appareance->setToolbarStyle(gtkToolbar.key(ui->cb_toolbar_icons->currentIndex())); appareance->setShowIconsInButtons(ui->checkBox_icon_gtk_buttons->isChecked()); @@ -197,10 +194,6 @@ { refreshThemesUi(true); - const auto newFont = stringToFont(appareance->getFont()); - if (newFont != ui->font->font()) - ui->font->setFont(newFont); - ui->cb_toolbar_icons->setCurrentIndex(gtkToolbar[appareance->getToolbarStyle()]); ui->checkBox_icon_gtk_buttons->setChecked(appareance->getShowIconsInButtons()); @@ -377,7 +370,6 @@ // qDebug() << "loading defaults..."; m_saveEnabled = false; - ui->font->setFont(font()); bool showIcons = !QCoreApplication::testAttribute(Qt::AA_DontShowIconsInMenus); ui->checkBox_icon_gtk_buttons->setChecked(showIcons); ui->checkBox_icon_gtk_menus->setChecked(showIcons); diff --git a/src/ui/gui.ui b/src/ui/gui.ui --- a/src/ui/gui.ui +++ b/src/ui/gui.ui @@ -97,23 +97,6 @@ - - - - Font: - - - - - - - - 0 - 0 - - - - @@ -473,21 +456,14 @@ Get New GNOME/GTK Application Styles... - + - - - KFontRequester - QWidget -
kfontrequester.h
-
-
diff --git a/tests/configsavetest.cpp b/tests/configsavetest.cpp --- a/tests/configsavetest.cpp +++ b/tests/configsavetest.cpp @@ -16,7 +16,6 @@ static void fillValues(QScopedPointer& a) { - a->setFont("a"); a->setIcon("a"); a->setTheme("a"); a->setToolbarStyle("a"); @@ -34,7 +33,6 @@ void compareAppearances(QScopedPointer& reloaded, QScopedPointer& instance) { - QCOMPARE(reloaded->getFont(), instance->getFont()); QCOMPARE(reloaded->getIcon(), instance->getIcon()); QCOMPARE(reloaded->getTheme(), instance->getTheme()); QCOMPARE(reloaded->getCursor(), instance->getCursor());