forked from lxqt/lxqt-qtplugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f219a95
Showing
8 changed files
with
860 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Copyright (C) 2013 Hong Jen Yee (PCMan) <[email protected]> | ||
|
||
The file qguiplatformplugin_p.h is taken from Qt 4.8 source code. | ||
Copyright (C) 2013 Digia Plc and/or its subsidiary. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# version >= 2.8.6 is needed because of CMAKE_AUTOMOC feature | ||
cmake_minimum_required(VERSION 2.8.6) | ||
project(lxqt-qtplugin) | ||
|
||
# Standard directories for installation | ||
# include(GNUInstallDirs) | ||
|
||
# FIXME: support Qt5 | ||
find_package(Qt4 4.6 REQUIRED QtCore QtGui) | ||
include(${QT_USE_FILE}) | ||
|
||
find_package(LxQt REQUIRED) | ||
include(${LXQT_USE_FILE}) | ||
|
||
if (CMAKE_COMPILER_IS_GNUCXX) | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions -Wl,-no-undefined -Wall") | ||
endif() | ||
|
||
# Eanble CMake auto-moc support for Qt | ||
set(CMAKE_AUTOMOC TRUE) | ||
|
||
include_directories( | ||
${QT_INCLUDES} | ||
${LXQT_INCLUDE_DIRS} | ||
${CMAKE_CURRENT_BINARY_DIR} | ||
${CMAKE_CURRENT_SOURCE_DIR} | ||
) | ||
|
||
set(qtlxqt_SRCS | ||
lxqtguiplatformplugin.cpp | ||
lxqtguiplatformplugin.h | ||
qguiplatformplugin_p.h | ||
) | ||
|
||
add_library(qtlxqt SHARED ${qtlxqt_SRCS}) | ||
|
||
target_link_libraries(qtlxqt | ||
${QT_QTCORE_LIBRARY} | ||
${QT_QTGUI_LIBRARY} | ||
${LXQT_LIBRARIES} | ||
) | ||
|
||
install (TARGETS qtlxqt LIBRARY DESTINATION ${QT_PLUGINS_DIR}/gui_platform) |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
libqtlxqt - LXDE-Qt system integration plugin for Qt. | ||
|
||
With this plugin, all Qt-based programs can adopt settings of | ||
LXDE-Qt, such as the icon theme. | ||
|
||
To let Qt load the plugin, export the environment variable | ||
QT_PLATFORM_PLUGIN=lxqt or DESKTOP_SESSION=lxqt. | ||
However, setting DESKTOP_SESSION might affect the behaviors | ||
of other tools such as xdg-tools. If this is not the desired | ||
effect, use QT_PLATFORM_PLUGIN. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[Project] | ||
Manager=KDevCMakeManager | ||
Name=lxqt-qtplugin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
/* BEGIN_COMMON_COPYRIGHT_HEADER | ||
* (c)LGPL2+ | ||
* | ||
* LXDE-Qt - a lightweight, Qt based, desktop toolset | ||
* http://lxde.org/ | ||
* | ||
* Copyright: 2013 LXDE-Qt team | ||
* Authors: | ||
* Hong Jen Yee (PCMan) <[email protected]> | ||
* | ||
* This program or 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) any later version. | ||
* | ||
* 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, write to the | ||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
* Boston, MA 02110-1301 USA | ||
* | ||
* END_COMMON_COPYRIGHT_HEADER */ | ||
|
||
#include "lxqtguiplatformplugin.h" | ||
#include <QDebug> | ||
#include <QIcon> | ||
#include <QFileInfo> | ||
#include <QApplication> | ||
#include <QWidget> | ||
|
||
Q_EXPORT_PLUGIN2(LxQtGuiPlatformPlugin, LxQtGuiPlatformPlugin) | ||
|
||
LxQtGuiPlatformPlugin::LxQtGuiPlatformPlugin() { | ||
qDebug() << "LxQtGuiPlatformPlugin constructed"; | ||
connect(LxQt::Settings::globalSettings(), SIGNAL(iconThemeChanged()), SLOT(onIconThemeChanged())); | ||
connect(LxQt::Settings::globalSettings(), SIGNAL(settingsChanged()), SLOT(onSettingsChanged())); | ||
} | ||
|
||
LxQtGuiPlatformPlugin::~LxQtGuiPlatformPlugin() { | ||
} | ||
|
||
QString LxQtGuiPlatformPlugin::styleName() { | ||
qDebug() << "LxQtGuiPlatformPlugin::styleName() is called"; | ||
return "fusion"; | ||
} | ||
|
||
QPalette LxQtGuiPlatformPlugin::palette() { | ||
return QGuiPlatformPlugin::palette(); | ||
} | ||
|
||
QString LxQtGuiPlatformPlugin::systemIconThemeName() { | ||
qDebug() << "LxQtGuiPlatformPlugin::systemIconThemeName() is called"; | ||
return LxQt::Settings::globalSettings()->value("icon_theme").toString(); | ||
} | ||
|
||
/* | ||
QIcon LxQtGuiPlatformPlugin::fileSystemIcon(const QFileInfo& info) { | ||
return QGuiPlatformPlugin::fileSystemIcon(info); | ||
} | ||
QStringList LxQtGuiPlatformPlugin::iconThemeSearchPaths() { | ||
return QGuiPlatformPlugin::iconThemeSearchPaths(); | ||
} | ||
*/ | ||
|
||
int LxQtGuiPlatformPlugin::platformHint(QGuiPlatformPlugin::PlatformHint hint) { | ||
qDebug() << "LxQtGuiPlatformPlugin::platformHint() is called"; | ||
int ret = 0; | ||
switch(hint) { | ||
case PH_ToolButtonStyle: | ||
ret = Qt::ToolButtonTextBesideIcon; | ||
break; | ||
case PH_ToolBarIconSize: | ||
case PH_ItemView_ActivateItemOnSingleClick: | ||
default: | ||
return QGuiPlatformPlugin::platformHint(hint); | ||
} | ||
return ret; | ||
} | ||
|
||
void LxQtGuiPlatformPlugin::onIconThemeChanged() { | ||
Q_FOREACH(QWidget* widget, QApplication::allWidgets()) { | ||
QEvent event(QEvent::StyleChange); | ||
QApplication::sendEvent(widget, &event); | ||
} | ||
} | ||
|
||
void LxQtGuiPlatformPlugin::onSettingsChanged() { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/* BEGIN_COMMON_COPYRIGHT_HEADER | ||
* (c)LGPL2+ | ||
* | ||
* LXDE-Qt - a lightweight, Qt based, desktop toolset | ||
* http://lxde.org/ | ||
* | ||
* Copyright: 2013 LXDE-Qt team | ||
* Authors: | ||
* Hong Jen Yee (PCMan) <[email protected]> | ||
* | ||
* This program or 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) any later version. | ||
* | ||
* 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, write to the | ||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
* Boston, MA 02110-1301 USA | ||
* | ||
* END_COMMON_COPYRIGHT_HEADER */ | ||
|
||
#include "qguiplatformplugin_p.h" | ||
#include <QtGlobal> | ||
#include <lxqt/LxQtSettings> | ||
|
||
class LxQtGuiPlatformPlugin : public QGuiPlatformPlugin { | ||
Q_OBJECT | ||
public: | ||
explicit LxQtGuiPlatformPlugin(); | ||
virtual ~LxQtGuiPlatformPlugin(); | ||
|
||
virtual QStringList keys() const { return QStringList() << QLatin1String("lxqt"); } | ||
virtual QString styleName(); | ||
virtual QPalette palette(); | ||
virtual QString systemIconThemeName(); | ||
// virtual QStringList iconThemeSearchPaths(); | ||
// virtual QIcon fileSystemIcon(const QFileInfo& info); | ||
|
||
virtual int platformHint(PlatformHint hint); | ||
|
||
/* | ||
virtual void fileDialogDelete(QFileDialog *) {} | ||
virtual bool fileDialogSetVisible(QFileDialog *, bool) { return false; } | ||
virtual QDialog::DialogCode fileDialogResultCode(QFileDialog *) { return QDialog::Rejected; } | ||
virtual void fileDialogSetDirectory(QFileDialog *, const QString &) {} | ||
virtual QString fileDialogDirectory(const QFileDialog *) const { return QString(); } | ||
virtual void fileDialogSelectFile(QFileDialog *, const QString &) {} | ||
virtual QStringList fileDialogSelectedFiles(const QFileDialog *) const { return QStringList(); } | ||
virtual void fileDialogSetFilter(QFileDialog *) {} | ||
virtual void fileDialogSetNameFilters(QFileDialog *, const QStringList &) {} | ||
virtual void fileDialogSelectNameFilter(QFileDialog *, const QString &) {} | ||
virtual QString fileDialogSelectedNameFilter(const QFileDialog *) const { return QString(); } | ||
virtual void colorDialogDelete(QColorDialog *) {} | ||
virtual bool colorDialogSetVisible(QColorDialog *, bool) { return false; } | ||
virtual void colorDialogSetCurrentColor(QColorDialog *, const QColor &) {} | ||
*/ | ||
|
||
private Q_SLOTS: | ||
void onIconThemeChanged(); | ||
void onSettingsChanged(); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
/**************************************************************************** | ||
** | ||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). | ||
** Contact: http://www.qt-project.org/legal | ||
** | ||
** 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 Digia. For licensing terms and | ||
** conditions see http://qt.digia.com/licensing. For further information | ||
** use the contact form at http://qt.digia.com/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 as published by the Free Software | ||
** Foundation and appearing in the file LICENSE.LGPL included in the | ||
** packaging of this file. Please review the following information to | ||
** ensure the GNU Lesser General Public License version 2.1 requirements | ||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | ||
** | ||
** In addition, as a special exception, Digia gives you certain additional | ||
** rights. These rights are described in the Digia Qt 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 QGUIPLATFORM_P_H | ||
#define QGUIPLATFORM_P_H | ||
|
||
// | ||
// 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. | ||
// | ||
|
||
#include <QtCore/qplugin.h> | ||
#include <QtCore/qfactoryinterface.h> | ||
#include <QtGui/qdialog.h> | ||
|
||
QT_BEGIN_HEADER | ||
|
||
QT_BEGIN_NAMESPACE | ||
|
||
QT_MODULE(Gui) | ||
|
||
class QStyle; | ||
class QPalette; | ||
class QIcon; | ||
class QFileDialog; | ||
class QColorDialog; | ||
class QFileInfo; | ||
|
||
struct Q_GUI_EXPORT QGuiPlatformPluginInterface : public QFactoryInterface | ||
{ | ||
}; | ||
|
||
#define QGuiPlatformPluginInterface_iid "com.nokia.qt.QGuiPlatformPluginInterface" | ||
|
||
Q_DECLARE_INTERFACE(QGuiPlatformPluginInterface, QGuiPlatformPluginInterface_iid) | ||
|
||
class Q_GUI_EXPORT QGuiPlatformPlugin : public QObject, public QGuiPlatformPluginInterface | ||
{ | ||
Q_OBJECT | ||
Q_INTERFACES(QGuiPlatformPluginInterface:QFactoryInterface) | ||
public: | ||
explicit QGuiPlatformPlugin(QObject *parent = 0); | ||
~QGuiPlatformPlugin(); | ||
|
||
virtual QStringList keys() const { return QStringList() << QLatin1String("default"); }; | ||
|
||
virtual QString styleName(); | ||
virtual QPalette palette(); | ||
virtual QString systemIconThemeName(); | ||
virtual QStringList iconThemeSearchPaths(); | ||
virtual QIcon fileSystemIcon(const QFileInfo &); | ||
|
||
enum PlatformHint { PH_ToolButtonStyle, PH_ToolBarIconSize, PH_ItemView_ActivateItemOnSingleClick }; | ||
virtual int platformHint(PlatformHint hint); | ||
|
||
|
||
virtual void fileDialogDelete(QFileDialog *) {} | ||
virtual bool fileDialogSetVisible(QFileDialog *, bool) { return false; } | ||
virtual QDialog::DialogCode fileDialogResultCode(QFileDialog *) { return QDialog::Rejected; } | ||
virtual void fileDialogSetDirectory(QFileDialog *, const QString &) {} | ||
virtual QString fileDialogDirectory(const QFileDialog *) const { return QString(); } | ||
virtual void fileDialogSelectFile(QFileDialog *, const QString &) {} | ||
virtual QStringList fileDialogSelectedFiles(const QFileDialog *) const { return QStringList(); } | ||
virtual void fileDialogSetFilter(QFileDialog *) {} | ||
virtual void fileDialogSetNameFilters(QFileDialog *, const QStringList &) {} | ||
virtual void fileDialogSelectNameFilter(QFileDialog *, const QString &) {} | ||
virtual QString fileDialogSelectedNameFilter(const QFileDialog *) const { return QString(); } | ||
|
||
virtual void colorDialogDelete(QColorDialog *) {} | ||
virtual bool colorDialogSetVisible(QColorDialog *, bool) { return false; } | ||
virtual void colorDialogSetCurrentColor(QColorDialog *, const QColor &) {} | ||
}; | ||
|
||
//internal | ||
QGuiPlatformPlugin *qt_guiPlatformPlugin(); | ||
|
||
QT_END_NAMESPACE | ||
|
||
QT_END_HEADER | ||
|
||
|
||
#endif // QGUIPLATFORMPLUGIN_H | ||
|