mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-24 10:52:51 +00:00
plasma: merge plasmaextracomponents declarative imports into plasmacomponents
the FallbackComponent type is unused Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
bcd85dcd0a
commit
27bf4c46cc
14 changed files with 8 additions and 292 deletions
|
@ -22,7 +22,6 @@ import QtQuick 1.1
|
||||||
import org.kde.plasma.core 0.1 as PlasmaCore
|
import org.kde.plasma.core 0.1 as PlasmaCore
|
||||||
import org.kde.plasma.components 0.1 as PlasmaComponents
|
import org.kde.plasma.components 0.1 as PlasmaComponents
|
||||||
import org.kde.qtextracomponents 0.1
|
import org.kde.qtextracomponents 0.1
|
||||||
import org.kde.plasma.extras 0.1 as PlasmaExtras
|
|
||||||
|
|
||||||
|
|
||||||
PlasmaCore.Dialog {
|
PlasmaCore.Dialog {
|
||||||
|
|
|
@ -22,7 +22,6 @@ import QtQuick 1.1
|
||||||
import org.kde.plasma.core 0.1 as PlasmaCore
|
import org.kde.plasma.core 0.1 as PlasmaCore
|
||||||
import org.kde.plasma.components 0.1 as PlasmaComponents
|
import org.kde.plasma.components 0.1 as PlasmaComponents
|
||||||
import org.kde.qtextracomponents 0.1
|
import org.kde.qtextracomponents 0.1
|
||||||
import org.kde.plasma.extras 0.1 as PlasmaExtras
|
|
||||||
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
|
|
|
@ -22,7 +22,6 @@ import QtQuick 1.1
|
||||||
import org.kde.plasma.core 0.1 as PlasmaCore
|
import org.kde.plasma.core 0.1 as PlasmaCore
|
||||||
import org.kde.plasma.components 0.1 as PlasmaComponents
|
import org.kde.plasma.components 0.1 as PlasmaComponents
|
||||||
import org.kde.qtextracomponents 0.1
|
import org.kde.qtextracomponents 0.1
|
||||||
import org.kde.plasma.extras 0.1 as PlasmaExtras
|
|
||||||
import org.kde.locale 0.1 as KLocale
|
import org.kde.locale 0.1 as KLocale
|
||||||
|
|
||||||
import "uiproperties.js" as UiProperties
|
import "uiproperties.js" as UiProperties
|
||||||
|
@ -110,7 +109,7 @@ MouseEventListener {
|
||||||
|
|
||||||
hoverEnabled: !UiProperties.touchInput
|
hoverEnabled: !UiProperties.touchInput
|
||||||
|
|
||||||
PlasmaExtras.ScrollArea {
|
PlasmaComponents.ScrollArea {
|
||||||
id: mainScrollArea
|
id: mainScrollArea
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
implicitWidth: theme.defaultFont.mSize.width * 40
|
implicitWidth: theme.defaultFont.mSize.width * 40
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
import QtQuick 1.1
|
import QtQuick 1.1
|
||||||
import org.kde.plasma.graphicswidgets 0.1 as PlasmaWidgets
|
import org.kde.plasma.graphicswidgets 0.1 as PlasmaWidgets
|
||||||
import org.kde.plasma.components 0.1 as PlasmaComponents
|
import org.kde.plasma.components 0.1 as PlasmaComponents
|
||||||
import org.kde.plasma.extras 0.1 as PlasmaExtras
|
|
||||||
import Private 0.1
|
import Private 0.1
|
||||||
|
|
||||||
import "../code/IconsList.js" as IconsListJS
|
import "../code/IconsList.js" as IconsListJS
|
||||||
|
|
|
@ -3,5 +3,4 @@ add_subdirectory(draganddrop)
|
||||||
add_subdirectory(graphicswidgets)
|
add_subdirectory(graphicswidgets)
|
||||||
add_subdirectory(qtextracomponents)
|
add_subdirectory(qtextracomponents)
|
||||||
add_subdirectory(plasmacomponents)
|
add_subdirectory(plasmacomponents)
|
||||||
add_subdirectory(plasmaextracomponents)
|
|
||||||
add_subdirectory(locale)
|
add_subdirectory(locale)
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import QtQuick 1.1
|
import QtQuick 1.1
|
||||||
import org.kde.plasma.components 0.1 as PlasmaComponents
|
|
||||||
import org.kde.plasma.core 0.1 as PlasmaCore
|
import org.kde.plasma.core 0.1 as PlasmaCore
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -126,7 +125,7 @@ Item {
|
||||||
}
|
}
|
||||||
Component {
|
Component {
|
||||||
id: verticalScrollBarComponent
|
id: verticalScrollBarComponent
|
||||||
PlasmaComponents.ScrollBar {
|
ScrollBar {
|
||||||
flickableItem: root.flickableItem
|
flickableItem: root.flickableItem
|
||||||
orientation: Qt.Vertical
|
orientation: Qt.Vertical
|
||||||
property bool isScrollBar: true
|
property bool isScrollBar: true
|
||||||
|
@ -143,7 +142,7 @@ Item {
|
||||||
}
|
}
|
||||||
Component {
|
Component {
|
||||||
id: horizontalScrollBarComponent
|
id: horizontalScrollBarComponent
|
||||||
PlasmaComponents.ScrollBar {
|
ScrollBar {
|
||||||
flickableItem: root.flickableItem
|
flickableItem: root.flickableItem
|
||||||
orientation: Qt.Horizontal
|
orientation: Qt.Horizontal
|
||||||
z: root.flickableItem.z + 1
|
z: root.flickableItem.z + 1
|
||||||
|
@ -159,7 +158,7 @@ Item {
|
||||||
}
|
}
|
||||||
Component {
|
Component {
|
||||||
id: sectionScrollerComponent
|
id: sectionScrollerComponent
|
||||||
PlasmaComponents.SectionScroller {
|
SectionScroller {
|
||||||
listView: root.flickableItem
|
listView: root.flickableItem
|
||||||
property bool isScrollBar: false
|
property bool isScrollBar: false
|
||||||
z: root.flickableItem.z + 1
|
z: root.flickableItem.z + 1
|
|
@ -27,10 +27,10 @@ import org.kde.plasma.components 0.1
|
||||||
*
|
*
|
||||||
* Example usage:
|
* Example usage:
|
||||||
* @code
|
* @code
|
||||||
* import org.kde.plasma.extras 0.1 as PlasmaExtras
|
* import org.kde.plasma.components 0.1 as PlasmaComponents
|
||||||
* [...]
|
* [...]
|
||||||
* Column {
|
* Column {
|
||||||
* PlasmaExtras.Title { text: "Fruit sweetness on the rise" }
|
* PlasmaComponents.Title { text: "Fruit sweetness on the rise" }
|
||||||
* [...]
|
* [...]
|
||||||
* }
|
* }
|
||||||
* @endcode
|
* @endcode
|
|
@ -15,3 +15,5 @@ TabBar 0.1 TabBar.qml
|
||||||
TabButton 0.1 TabButton.qml
|
TabButton 0.1 TabButton.qml
|
||||||
TabGroup 0.1 TabGroup.qml
|
TabGroup 0.1 TabGroup.qml
|
||||||
ToolButton 0.1 ToolButton.qml
|
ToolButton 0.1 ToolButton.qml
|
||||||
|
ScrollArea 0.1 ScrollArea.qml
|
||||||
|
Title 0.1 Title.qml
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
project(plasmaextracomponents)
|
|
||||||
|
|
||||||
set(plasmaextracomponents_SRCS
|
|
||||||
plasmaextracomponentsplugin.cpp
|
|
||||||
fallbackcomponent.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
add_library(plasmaextracomponentsplugin SHARED ${plasmaextracomponents_SRCS})
|
|
||||||
target_link_libraries(plasmaextracomponentsplugin
|
|
||||||
KDE4::plasma
|
|
||||||
${QT_QTCORE_LIBRARY}
|
|
||||||
${QT_QTDECLARATIVE_LIBRARY}
|
|
||||||
${QT_QTGUI_LIBRARY}
|
|
||||||
)
|
|
||||||
|
|
||||||
install(
|
|
||||||
TARGETS plasmaextracomponentsplugin
|
|
||||||
DESTINATION ${KDE4_IMPORTS_INSTALL_DIR}/org/kde/plasma/extras
|
|
||||||
)
|
|
||||||
|
|
||||||
install(
|
|
||||||
DIRECTORY qml/
|
|
||||||
DESTINATION ${KDE4_IMPORTS_INSTALL_DIR}/org/kde/plasma/extras
|
|
||||||
)
|
|
|
@ -1,91 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2011 Marco Martin <mart@kde.org>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Library General Public License as
|
|
||||||
* published by the Free Software Foundation; either version 2, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program 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 Library General Public License for more details
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Library General Public
|
|
||||||
* License along with this program; if not, write to the
|
|
||||||
* Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "fallbackcomponent.h"
|
|
||||||
|
|
||||||
#include <QDir>
|
|
||||||
#include <QFile>
|
|
||||||
|
|
||||||
#include <KStandardDirs>
|
|
||||||
#include <KDebug>
|
|
||||||
|
|
||||||
|
|
||||||
FallbackComponent::FallbackComponent(QObject *parent)
|
|
||||||
: QObject(parent)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
QString FallbackComponent::basePath() const
|
|
||||||
{
|
|
||||||
return m_basePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
void FallbackComponent::setBasePath(const QString &basePath)
|
|
||||||
{
|
|
||||||
if (basePath != m_basePath) {
|
|
||||||
m_basePath = basePath;
|
|
||||||
emit basePathChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QStringList FallbackComponent::candidates() const
|
|
||||||
{
|
|
||||||
return m_candidates;
|
|
||||||
}
|
|
||||||
|
|
||||||
void FallbackComponent::setCandidates(const QStringList &candidates)
|
|
||||||
{
|
|
||||||
m_candidates = candidates;
|
|
||||||
emit candidatesChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
QString FallbackComponent::filePath(const QString &key)
|
|
||||||
{
|
|
||||||
QString resolved;
|
|
||||||
|
|
||||||
foreach (const QString &path, m_candidates) {
|
|
||||||
kDebug() << "Searching for:" << path + path;
|
|
||||||
if (m_possiblePaths.contains(path + key)) {
|
|
||||||
resolved = *m_possiblePaths.object(path + key);
|
|
||||||
if (!resolved.isEmpty()) {
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QDir tmpPath(m_basePath);
|
|
||||||
|
|
||||||
if (tmpPath.isAbsolute()) {
|
|
||||||
resolved = m_basePath + path + key;
|
|
||||||
} else {
|
|
||||||
|
|
||||||
resolved = KStandardDirs::locate("data", m_basePath + '/' + path + key);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_possiblePaths.insert(path + key, new QString(resolved));
|
|
||||||
if (!resolved.isEmpty()) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return resolved;
|
|
||||||
}
|
|
||||||
|
|
||||||
#include "moc_fallbackcomponent.cpp"
|
|
|
@ -1,78 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2011 Marco Martin <mart@kde.org>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Library General Public License as
|
|
||||||
* published by the Free Software Foundation; either version 2, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program 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 Library General Public License for more details
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Library General Public
|
|
||||||
* License along with this program; if not, write to the
|
|
||||||
* Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef FALLBACKCOMPONENT_H
|
|
||||||
#define FALLBACKCOMPONENT_H
|
|
||||||
|
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
#include <QCache>
|
|
||||||
#include <QStringList>
|
|
||||||
|
|
||||||
class FallbackComponent : public QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Prefix of the path
|
|
||||||
* This should be something like "plasma","kwin","plasmate",etc
|
|
||||||
* If the basePath is "plasma", it will be set for the data of plasma like,
|
|
||||||
* or it can be an absolute path
|
|
||||||
**/
|
|
||||||
Q_PROPERTY(QString basePath READ basePath WRITE setBasePath NOTIFY basePathChanged)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The possible candidates in order to have a complete path.
|
|
||||||
* basepath/candidate, where candidate is the first one in the list of candidates
|
|
||||||
* in order of importance that matches an existing file
|
|
||||||
**/
|
|
||||||
Q_PROPERTY(QStringList candidates READ candidates WRITE setCandidates NOTIFY candidatesChanged)
|
|
||||||
|
|
||||||
public:
|
|
||||||
FallbackComponent(QObject *parent = 0);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This method must be called after the the basePath and the candidates property
|
|
||||||
* This method resolves a file path based on the base path and the candidates.
|
|
||||||
* it searches for a file named key under basepath/candidate/key, and returns
|
|
||||||
* the path constructed with the first candidate that matches, if any.
|
|
||||||
*
|
|
||||||
* @param key the name of the file to search for
|
|
||||||
**/
|
|
||||||
Q_INVOKABLE QString filePath(const QString& key = QString());
|
|
||||||
|
|
||||||
QString basePath() const;
|
|
||||||
void setBasePath(const QString &basePath);
|
|
||||||
|
|
||||||
|
|
||||||
QStringList candidates() const;
|
|
||||||
void setCandidates(const QStringList &candidates);
|
|
||||||
|
|
||||||
|
|
||||||
Q_SIGNALS:
|
|
||||||
void basePathChanged();
|
|
||||||
void candidatesChanged();
|
|
||||||
|
|
||||||
private:
|
|
||||||
QCache<QString, QString> m_possiblePaths;
|
|
||||||
QString m_basePath;
|
|
||||||
QStringList m_candidates;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,44 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2012 by Sebastian Kügler <sebas@kde.org>
|
|
||||||
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Library General Public License as
|
|
||||||
* published by the Free Software Foundation; either version 2, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program 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 General Public License for more details
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Library General Public
|
|
||||||
* License along with this program; if not, write to the
|
|
||||||
* Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "plasmaextracomponentsplugin.h"
|
|
||||||
|
|
||||||
#include "fallbackcomponent.h"
|
|
||||||
|
|
||||||
#include <QtDeclarative/qdeclarative.h>
|
|
||||||
#include <QtDeclarative/QDeclarativeEngine>
|
|
||||||
|
|
||||||
|
|
||||||
// #include <KSharedConfig>
|
|
||||||
// #include <KConfigGroup>
|
|
||||||
|
|
||||||
void PlasmaExtraComponentsPlugin::initializeEngine(QDeclarativeEngine *engine, const char *uri)
|
|
||||||
{
|
|
||||||
Q_ASSERT(uri == QLatin1String("org.kde.plasma.extras"));
|
|
||||||
}
|
|
||||||
|
|
||||||
void PlasmaExtraComponentsPlugin::registerTypes(const char *uri)
|
|
||||||
{
|
|
||||||
Q_ASSERT(uri == QLatin1String("org.kde.plasma.extras"));
|
|
||||||
qmlRegisterType<FallbackComponent>(uri, 0, 1, "FallbackComponent");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#include "moc_plasmaextracomponentsplugin.cpp"
|
|
||||||
|
|
|
@ -1,39 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2011 by Marco Martin <mart@kde.org>
|
|
||||||
* Copyright 2012 by Sebastian Kügler <sebas@kde.org>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Library General Public License as
|
|
||||||
* published by the Free Software Foundation; either version 2, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program 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 General Public License for more details
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Library General Public
|
|
||||||
* License along with this program; if not, write to the
|
|
||||||
* Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef PLASMAEXTRACOMPONENTSPLUGIN_H
|
|
||||||
#define PLASMAEXTRACOMPONENTSPLUGIN_H
|
|
||||||
|
|
||||||
#include <QDeclarativeExtensionPlugin>
|
|
||||||
|
|
||||||
#include <QDeclarativeEngine>
|
|
||||||
|
|
||||||
class PlasmaExtraComponentsPlugin : public QDeclarativeExtensionPlugin
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
void initializeEngine(QDeclarativeEngine *engine, const char *uri);
|
|
||||||
void registerTypes(const char *uri);
|
|
||||||
};
|
|
||||||
|
|
||||||
Q_EXPORT_PLUGIN(PlasmaExtraComponentsPlugin);
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,4 +0,0 @@
|
||||||
plugin plasmaextracomponentsplugin
|
|
||||||
|
|
||||||
ScrollArea 0.1 ScrollArea.qml
|
|
||||||
Title 0.1 Title.qml
|
|
Loading…
Add table
Reference in a new issue