mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-24 02:42:55 +00:00
remove kde specific settings code
KDE4 provides a platform plugin that can do everything the custom code was doing so there is no need for it Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
This commit is contained in:
parent
cb57279c1e
commit
c937eb3e08
7 changed files with 16 additions and 329 deletions
|
@ -83,7 +83,6 @@ if(WITH_X11 AND X11_FOUND)
|
|||
${GUI_HEADERS}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/kernel/qx11embed_x11.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/kernel/qx11info_x11.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/kernel/qkde_p.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/kernel/qeventdispatcher_x11_p.h
|
||||
)
|
||||
set(GUI_SOURCES
|
||||
|
@ -99,7 +98,6 @@ if(WITH_X11 AND X11_FOUND)
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/kernel/qx11embed_x11.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/kernel/qx11info_x11.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/kernel/qkeymapper_x11.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/kernel/qkde.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/kernel/qeventdispatcher_x11.cpp
|
||||
)
|
||||
if(WITH_GLIB2 AND GLIB2_FOUND)
|
||||
|
|
|
@ -756,7 +756,7 @@ QApplication::QApplication(Display *dpy, int &argc, char **argv,
|
|||
|
||||
#endif // Q_WS_X11
|
||||
|
||||
extern void qInitDrawhelperAsm();
|
||||
extern void qInitDrawhelper();
|
||||
extern int qRegisterGuiVariant();
|
||||
extern int qUnregisterGuiVariant();
|
||||
|
||||
|
@ -793,7 +793,7 @@ void QApplicationPrivate::initialize()
|
|||
q->setAttribute(Qt::AA_NativeWindows);
|
||||
|
||||
// Set up which span functions should be used in raster engine...
|
||||
qInitDrawhelperAsm();
|
||||
qInitDrawhelper();
|
||||
|
||||
#ifndef QT_NO_WHEELEVENT
|
||||
QApplicationPrivate::wheel_scroll_lines = 3;
|
||||
|
|
|
@ -75,7 +75,6 @@
|
|||
#include "qlibrary.h"
|
||||
#include "qgraphicssystemfactory_p.h"
|
||||
#include "qguiplatformplugin_p.h"
|
||||
#include "qkde_p.h"
|
||||
#include "qthread_p.h"
|
||||
#include "qeventdispatcher_x11_p.h"
|
||||
#include <qpaintengine_x11_p.h>
|
||||
|
@ -732,34 +731,19 @@ bool QApplicationPrivate::x11_apply_settings()
|
|||
|
||||
// ### Fix properly for 4.6
|
||||
if (groupCount == QPalette::NColorGroups)
|
||||
QApplicationPrivate::setSystemPalette(pal);
|
||||
QApplicationPrivate::setSystemPalette(pal);
|
||||
|
||||
if (!appFont) {
|
||||
// ### Fix properly for 4.6
|
||||
QFont font(QApplication::font());
|
||||
QString fontDescription;
|
||||
// Override Qt font if KDE4 settings can be used
|
||||
if (qt_x11Data->desktopVersion == 4) {
|
||||
QSettings kdeSettings(QKde::kdeHome() + QLatin1String("/share/config/kdeglobals"), QSettings::IniFormat);
|
||||
fontDescription = kdeSettings.value(QLatin1String("font")).toString();
|
||||
if (fontDescription.isEmpty()) {
|
||||
// KDE stores fonts without quotes
|
||||
fontDescription = kdeSettings.value(QLatin1String("font")).toStringList().join(QLatin1String(","));
|
||||
}
|
||||
}
|
||||
if (fontDescription.isEmpty())
|
||||
fontDescription = settings.value(QLatin1String("font")).toString();
|
||||
QString fontDescription = settings.value(QLatin1String("font")).toString();
|
||||
if (!fontDescription .isEmpty()) {
|
||||
QFont font(QApplication::font());
|
||||
font.fromString(fontDescription );
|
||||
QApplicationPrivate::setSystemFont(font);
|
||||
}
|
||||
}
|
||||
|
||||
// read library (ie. plugin) path list
|
||||
QString libpathkey =
|
||||
QString::fromLatin1("%1.%2/libraryPath")
|
||||
.arg(QT_VERSION >> 16)
|
||||
.arg((QT_VERSION & 0xff00) >> 8);
|
||||
QString libpathkey = QString::fromLatin1("libraryPath");
|
||||
QStringList pathlist = settings.value(libpathkey).toString().split(QLatin1Char(':'));
|
||||
if (! pathlist.isEmpty()) {
|
||||
QStringList::ConstIterator it = pathlist.constBegin();
|
||||
|
@ -2003,12 +1987,9 @@ void qt_init(QApplicationPrivate *priv, int,
|
|||
settings.beginGroup(QLatin1String("Qt"));
|
||||
|
||||
// read library (ie. plugin) path list
|
||||
QString libpathkey = QString::fromLatin1("%1.%2/libraryPath")
|
||||
.arg(QT_VERSION >> 16)
|
||||
.arg((QT_VERSION & 0xff00) >> 8);
|
||||
QStringList pathlist =
|
||||
settings.value(libpathkey).toString().split(QLatin1Char(':'));
|
||||
if (! pathlist.isEmpty()) {
|
||||
QString libpathkey = QString::fromLatin1("libraryPath");
|
||||
QStringList pathlist = settings.value(libpathkey).toString().split(QLatin1Char(':'));
|
||||
if (!pathlist.isEmpty()) {
|
||||
QStringList::ConstIterator it = pathlist.constBegin();
|
||||
while (it != pathlist.constEnd())
|
||||
QApplication::addLibraryPath(*it++);
|
||||
|
|
|
@ -51,7 +51,6 @@
|
|||
#include "qicon.h"
|
||||
|
||||
#if defined(Q_WS_X11)
|
||||
#include <qkde_p.h>
|
||||
#include <qt_x11_p.h>
|
||||
#endif
|
||||
|
||||
|
@ -127,7 +126,10 @@ QString QGuiPlatformPlugin::styleName()
|
|||
QString stylename;
|
||||
switch(qt_x11Data->desktopEnvironment) {
|
||||
case DE_KDE:
|
||||
stylename = QKde::kdeStyle();
|
||||
if (qt_x11Data->use_xrender)
|
||||
stylename = QLatin1String("plastique");
|
||||
else
|
||||
stylename = QLatin1String("windows");
|
||||
break;
|
||||
case DE_GNOME: {
|
||||
if (qt_x11Data->use_xrender)
|
||||
|
@ -150,31 +152,18 @@ QString QGuiPlatformPlugin::styleName()
|
|||
/* return an additional default palette (only work on X11) */
|
||||
QPalette QGuiPlatformPlugin::palette()
|
||||
{
|
||||
#ifdef Q_WS_X11
|
||||
if (QApplication::desktopSettingsAware() && qt_x11Data->desktopEnvironment == DE_KDE)
|
||||
return QKde::kdePalette();
|
||||
#endif
|
||||
|
||||
return QPalette();
|
||||
}
|
||||
|
||||
/* the default icon theme name for QIcon::fromTheme. */
|
||||
QString QGuiPlatformPlugin::systemIconThemeName()
|
||||
{
|
||||
QString result;
|
||||
#ifdef Q_WS_X11
|
||||
if (qt_x11Data->desktopEnvironment == DE_GNOME) {
|
||||
if (result.isEmpty()) {
|
||||
result = QString::fromLatin1("gnome");
|
||||
}
|
||||
} else if (qt_x11Data->desktopEnvironment == DE_KDE) {
|
||||
result = qt_x11Data->desktopVersion >= 4 ? QString::fromLatin1("oxygen") : QString::fromLatin1("crystalsvg");
|
||||
QSettings settings(QKde::kdeHome() + QLatin1String("/share/config/kdeglobals"), QSettings::IniFormat);
|
||||
settings.beginGroup(QLatin1String("Icons"));
|
||||
result = settings.value(QLatin1String("Theme"), result).toString();
|
||||
return QString::fromLatin1("gnome");
|
||||
}
|
||||
#endif
|
||||
return result;
|
||||
return QString();
|
||||
}
|
||||
|
||||
|
||||
|
@ -193,15 +182,6 @@ QStringList QGuiPlatformPlugin::iconThemeSearchPaths()
|
|||
if (dir.exists())
|
||||
paths.append(dir.path() + QLatin1String("/icons"));
|
||||
}
|
||||
if (qt_x11Data->desktopEnvironment == DE_KDE) {
|
||||
paths << QLatin1Char(':') + QKde::kdeHome() + QLatin1String("/share/icons");
|
||||
QStringList kdeDirs = QFile::decodeName(getenv("KDEDIRS")).split(QLatin1Char(':'));
|
||||
for (int i = 0 ; i< kdeDirs.count() ; ++i) {
|
||||
QDir dir(QLatin1Char(':') + kdeDirs.at(i) + QLatin1String("/share/icons"));
|
||||
if (dir.exists())
|
||||
paths.append(dir.path());
|
||||
}
|
||||
}
|
||||
|
||||
// Add home directory first in search path
|
||||
QDir homeDir(QDir::homePath() + QLatin1String("/.icons"));
|
||||
|
@ -226,20 +206,8 @@ int QGuiPlatformPlugin::platformHint(PlatformHint hint)
|
|||
{
|
||||
case PH_ToolButtonStyle:
|
||||
ret = Qt::ToolButtonIconOnly;
|
||||
#ifdef Q_WS_X11
|
||||
if (qt_x11Data->desktopEnvironment == DE_KDE && qt_x11Data->desktopVersion >= 4
|
||||
&& QApplication::desktopSettingsAware()) {
|
||||
ret = QKde::kdeToolButtonStyle();
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case PH_ToolBarIconSize:
|
||||
#ifdef Q_WS_X11
|
||||
if (qt_x11Data->desktopEnvironment == DE_KDE && qt_x11Data->desktopVersion >= 4
|
||||
&& QApplication::desktopSettingsAware()) {
|
||||
ret = QKde::kdeToolBarIconSize();
|
||||
}
|
||||
#endif
|
||||
//by default keep ret = 0 so QCommonStyle will use the style default
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -1,179 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 The Qt Company Ltd.
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the QtGui module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** As a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
#include "qkde_p.h"
|
||||
#include <QtCore/QDir>
|
||||
#include <QtCore/qdebug.h>
|
||||
#include <QtCore/QSettings>
|
||||
#include "QtGui/qstylefactory.h"
|
||||
#include "qt_x11_p.h"
|
||||
|
||||
#if defined(Q_WS_X11)
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
/*! \internal
|
||||
Gets the current KDE home path
|
||||
like "/home/troll/.kde"
|
||||
*/
|
||||
QString QKde::kdeHome()
|
||||
{
|
||||
static QString kdeHomePath;
|
||||
if (kdeHomePath.isEmpty()) {
|
||||
kdeHomePath = QString::fromLocal8Bit(qgetenv("KDEHOME"));
|
||||
if (kdeHomePath.isEmpty()) {
|
||||
QDir homeDir(QDir::homePath());
|
||||
QString kdeConfDir(QLatin1String("/.kde"));
|
||||
if (4 == qt_x11Data->desktopVersion && homeDir.exists(QLatin1String(".kde4")))
|
||||
kdeConfDir = QLatin1String("/.kde4");
|
||||
kdeHomePath = QDir::homePath() + kdeConfDir;
|
||||
}
|
||||
}
|
||||
return kdeHomePath;
|
||||
}
|
||||
|
||||
/*!\internal
|
||||
Reads the color from the config, and store it in the palette with the given color role if found
|
||||
*/
|
||||
static bool kdeColor(QPalette *pal, QPalette::ColorRole role, const QSettings &kdeSettings, const QString &kde4Key, const QString &kde3Key = QString())
|
||||
{
|
||||
QVariant variant = kdeSettings.value(kde4Key);
|
||||
if (!variant.isValid())
|
||||
QVariant variant = kdeSettings.value(kde3Key);
|
||||
if (variant.isValid()) {
|
||||
QStringList values = variant.toStringList();
|
||||
if (values.size() == 3) {
|
||||
int r = values[0].toInt();
|
||||
int g = values[1].toInt();
|
||||
int b = values[2].toInt();
|
||||
pal->setBrush(role, QColor(r, g, b));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/*!\internal
|
||||
Returns the KDE palette
|
||||
*/
|
||||
QPalette QKde::kdePalette()
|
||||
{
|
||||
const QSettings theKdeSettings(QKde::kdeHome() +
|
||||
QLatin1String("/share/config/kdeglobals"), QSettings::IniFormat);
|
||||
QPalette pal;
|
||||
|
||||
// Setup KDE palette
|
||||
kdeColor(&pal, QPalette::Button, theKdeSettings, QLatin1String("Colors:Button/BackgroundNormal"), QLatin1String("buttonBackground"));
|
||||
kdeColor(&pal, QPalette::Window, theKdeSettings, QLatin1String("Colors:Window/BackgroundNormal"), QLatin1String("background"));
|
||||
kdeColor(&pal, QPalette::Text, theKdeSettings, QLatin1String("Colors:View/ForegroundNormal"), QLatin1String("foreground"));
|
||||
kdeColor(&pal, QPalette::WindowText, theKdeSettings, QLatin1String("Colors:Window/ForegroundNormal"), QLatin1String("windowForeground"));
|
||||
kdeColor(&pal, QPalette::Base, theKdeSettings, QLatin1String("Colors:View/BackgroundNormal"), QLatin1String("windowBackground"));
|
||||
kdeColor(&pal, QPalette::Highlight, theKdeSettings, QLatin1String("Colors:Selection/BackgroundNormal"), QLatin1String("selectBackground"));
|
||||
kdeColor(&pal, QPalette::HighlightedText, theKdeSettings, QLatin1String("Colors:Selection/ForegroundNormal"), QLatin1String("selectForeground"));
|
||||
kdeColor(&pal, QPalette::AlternateBase, theKdeSettings, QLatin1String("Colors:View/BackgroundAlternate"), QLatin1String("alternateBackground"));
|
||||
kdeColor(&pal, QPalette::ButtonText, theKdeSettings, QLatin1String("Colors:Button/ForegroundNormal"), QLatin1String("buttonForeground"));
|
||||
kdeColor(&pal, QPalette::Link, theKdeSettings, QLatin1String("Colors:View/ForegroundLink"), QLatin1String("linkColor"));
|
||||
kdeColor(&pal, QPalette::LinkVisited, theKdeSettings, QLatin1String("Colors:View/ForegroundVisited"), QLatin1String("visitedLinkColor"));
|
||||
//## TODO tooltip color
|
||||
|
||||
return pal;
|
||||
}
|
||||
|
||||
/*!\internal
|
||||
Returns the name of the QStyle to use.
|
||||
(read from the kde config if needed)
|
||||
*/
|
||||
QString QKde::kdeStyle()
|
||||
{
|
||||
if (qt_x11Data->desktopVersion >= 4) {
|
||||
QSettings kdeSettings(QKde::kdeHome() + QLatin1String("/share/config/kdeglobals"), QSettings::IniFormat);
|
||||
QString style = kdeSettings.value(QLatin1String("widgetStyle"), QLatin1String("Oxygen")).toString();
|
||||
|
||||
QStringList availableStyles = QStyleFactory::keys();
|
||||
if(availableStyles.contains(style, Qt::CaseInsensitive))
|
||||
return style;
|
||||
}
|
||||
|
||||
if (qt_x11Data->use_xrender)
|
||||
return QLatin1String("plastique");
|
||||
else
|
||||
return QLatin1String("windows");
|
||||
}
|
||||
|
||||
|
||||
int QKde::kdeToolButtonStyle()
|
||||
{
|
||||
QSettings settings(QKde::kdeHome() + QLatin1String("/share/config/kdeglobals"),
|
||||
QSettings::IniFormat);
|
||||
settings.beginGroup(QLatin1String("Toolbar style"));
|
||||
QString toolbarStyle = settings.value(QLatin1String("ToolButtonStyle"), QLatin1String("TextBesideIcon")).toString();
|
||||
if (toolbarStyle == QLatin1String("TextBesideIcon"))
|
||||
return Qt::ToolButtonTextBesideIcon;
|
||||
else if (toolbarStyle == QLatin1String("TextOnly"))
|
||||
return Qt::ToolButtonTextOnly;
|
||||
else if (toolbarStyle == QLatin1String("TextUnderIcon"))
|
||||
return Qt::ToolButtonTextUnderIcon;
|
||||
|
||||
return Qt::ToolButtonTextBesideIcon;
|
||||
}
|
||||
|
||||
int QKde::kdeToolBarIconSize()
|
||||
{
|
||||
static int iconSize = -1;
|
||||
if (iconSize == -1) {
|
||||
QSettings settings(QKde::kdeHome() + QLatin1String("/share/config/kdeglobals"),
|
||||
QSettings::IniFormat);
|
||||
settings.beginGroup(QLatin1String("ToolbarIcons"));
|
||||
iconSize = settings.value(QLatin1String("Size")).toInt();
|
||||
}
|
||||
return iconSize;
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif //Q_WS_X11
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,81 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 The Qt Company Ltd.
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the QtGui module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** As a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QKDE_H
|
||||
#define QKDE_H
|
||||
|
||||
#include <QtCore/qglobal.h>
|
||||
#include <QtGui/QPalette>
|
||||
#include <QtGui/QIcon>
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
#if defined(Q_WS_X11)
|
||||
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
/*!\internal
|
||||
This namespace contains helper function to help KDE integration
|
||||
They are only used if we detect the use of KDE and the KDE platform plugin is not found (old KDE version)
|
||||
Or if the detected KDE version is KDE3
|
||||
*/
|
||||
namespace QKde {
|
||||
QString kdeHome();
|
||||
QString kdeStyle();
|
||||
QPalette kdePalette();
|
||||
int kdeToolButtonStyle();
|
||||
int kdeToolBarIconSize();
|
||||
}
|
||||
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // Q_WS_X11
|
||||
#endif // QKDE_H
|
|
@ -709,7 +709,7 @@ static const char charData[] __attribute__((aligned(64))) = {
|
|||
|
||||
// #142
|
||||
"\377\376\375\374\373\372\371\370\367\366"
|
||||
"%1.%2/libraryPath"
|
||||
"libraryPath"
|
||||
"\377\376\375\374\373" // 3824
|
||||
|
||||
// #143
|
||||
|
|
Loading…
Add table
Reference in a new issue