Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for C++ theming components #2

Merged
merged 3 commits into from Oct 7, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
@@ -0,0 +1,2 @@
*.pro.user
*.pyc
8 changes: 4 additions & 4 deletions examples/touch/content/ButtonPage.qml
Expand Up @@ -51,11 +51,11 @@ Item {
anchors.centerIn: parent

Button {
property bool isGlacier: Theme.name == "Glacier"
anchors.margins: 20
text: (Theme.themeName == NemoControls.themes[0]) ? "Set Ugly Theme"
: "Set Nice Theme"
onClicked: NemoControls.setTheme((Theme.themeName == NemoControls.themes[0]) ? NemoControls.themes[1]
: NemoControls.themes[0])
text: isGlacier ? "Set Ugly Theme" : "Set Nice Theme"
onClicked: isGlacier ? Theme.loadFromFile("ugly.json")
: Theme.loadFromFile("glacier.json")
}

Button {
Expand Down
36 changes: 18 additions & 18 deletions examples/touch/resources.qrc
@@ -1,19 +1,19 @@
<!DOCTYPE RCC><RCC version="1.0">
<qresource prefix="/">
<file>main.qml</file>
<file>content/AndroidDelegate.qml</file>
<file>content/ButtonPage.qml</file>
<file>content/ProgressBarPage.qml</file>
<file>content/SliderPage.qml</file>
<file>content/TabBarPage.qml</file>
<file>content/TextInputPage.qml</file>
<file>images/button_default.png</file>
<file>images/button_pressed.png</file>
<file>images/navigation_next_item.png</file>
<file>images/navigation_previous_item.png</file>
<file>images/tab_selected.png</file>
<file>images/tabs_standard.png</file>
<file>images/textinput.png</file>
<file>images/toolbar.png</file>
</qresource>
<RCC>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did you delete this? :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QtCreator did it :(

<qresource prefix="/">
<file>main.qml</file>
<file>content/AndroidDelegate.qml</file>
<file>content/ButtonPage.qml</file>
<file>content/ProgressBarPage.qml</file>
<file>content/SliderPage.qml</file>
<file>content/TabBarPage.qml</file>
<file>content/TextInputPage.qml</file>
<file>images/button_default.png</file>
<file>images/button_pressed.png</file>
<file>images/navigation_next_item.png</file>
<file>images/navigation_previous_item.png</file>
<file>images/tab_selected.png</file>
<file>images/tabs_standard.png</file>
<file>images/textinput.png</file>
<file>images/toolbar.png</file>
</qresource>
</RCC>
16 changes: 3 additions & 13 deletions src/controls/controls.pro
Expand Up @@ -3,17 +3,13 @@ CONFIG += qt plugin
QT += qml quick
TARGET=nemocontrolsplugin
PLUGIN_IMPORT_PATH = QtQuick/Controls/Nemo
THEME_IMPORT_PATH = QtQuick/Controls/Styles/Nemo/themes

# Added/Reimplemented Controls
QML_FILES += \
Button.qml

# Private files
QML_FILES += \
private/NemoControls.qml

OTHER_FILES += qmldir \
$$QML_FILES
OTHER_FILES += qmldir

HEADERS += \
qquicknemocontrolsextensionplugin.h \
Expand All @@ -29,10 +25,4 @@ qmlfiles.files = $$_PRO_FILE_PWD_/*.qml
qmlfiles.files += $$_PRO_FILE_PWD_/qmldir
qmlfiles.path = $$[QT_INSTALL_QML]/$$PLUGIN_IMPORT_PATH

privatefiles.files = $$_PRO_FILE_PWD_/private/*.qml
privatefiles.path = $$[QT_INSTALL_QML]/$$PLUGIN_IMPORT_PATH/private

INSTALLS += target privatefiles qmlfiles

#RESOURCES += \
# internal_resources.qrc
INSTALLS += target qmlfiles
6 changes: 0 additions & 6 deletions src/controls/internal_resources.qrc

This file was deleted.

56 changes: 0 additions & 56 deletions src/controls/private/NemoControls.qml

This file was deleted.

19 changes: 0 additions & 19 deletions src/controls/qquicknemocontrolsextensionplugin.cpp
Expand Up @@ -27,24 +27,6 @@ QQuickNemoControlsExtensionPlugin::QQuickNemoControlsExtensionPlugin(QObject *pa
{
}


static QObject *nemo_controls_singletontype_provider(QQmlEngine *engine, QJSEngine */*scriptEngine*/)
{
QObject *ret = 0;

QQmlComponent c(engine,QUrl("/usr/lib/qt5/qml/QtQuick/Controls/Nemo/private/NemoControls.qml"),QQmlComponent::PreferSynchronous);
if (c.status() == QQmlComponent::Ready) {
ret = c.create();
if (!ret) {
qWarning() << "Can't create NemoControls Singleton Object:"<<c.errorString();
}
} else {
qWarning() << "NemoControls Singleton Component not Ready:"<<c.errorString();
}

return ret;
}

static QObject *nemo_hacks_singletontype_provider(QQmlEngine *engine, QJSEngine */*scriptEngine*/)
{
QObject *ret = new Hacks(engine);
Expand All @@ -54,7 +36,6 @@ static QObject *nemo_hacks_singletontype_provider(QQmlEngine *engine, QJSEngine
void QQuickNemoControlsExtensionPlugin::registerTypes(const char *uri)
{
Q_ASSERT(uri == QLatin1String("QtQuick.Controls.Nemo"));
qmlRegisterSingletonType<QObject>(uri, 1, 0, "NemoControls", nemo_controls_singletontype_provider);
qmlRegisterSingletonType<QObject>(uri, 1, 0, "NemoHacks", nemo_hacks_singletontype_provider);

}
Expand Down
4 changes: 2 additions & 2 deletions src/styles/ButtonStyle.qml
Expand Up @@ -33,8 +33,8 @@ ButtonStyle {
implicitWidth: 240
implicitHeight: 50
clip: true
color: control.primary ? Theme.primaryButton.backgroundColor
: Theme.button.backgroundColor
color: control.primary ? Theme.primaryButton.background
: Theme.button.background
Image {
id: disabledImg
anchors.fill: parent
Expand Down
4 changes: 2 additions & 2 deletions src/styles/GrooveStyle.qml
Expand Up @@ -24,11 +24,11 @@ Component {
Rectangle {
implicitHeight: 16
implicitWidth: 440
color: Theme.groove.backgroundColor
color: Theme.groove.background
Rectangle {
antialiasing: true
radius: 1
color: Theme.groove.foregroundColor
color: Theme.groove.foreground
height: parent.height
width: parent.width * control.value / control.maximumValue
}
Expand Down