diff --git a/examples/examples.pro b/examples/examples.pro index e105ae6..c8f7dc0 100644 --- a/examples/examples.pro +++ b/examples/examples.pro @@ -1,3 +1,3 @@ TEMPLATE=subdirs -SUBDIRS+= touch +SUBDIRS+= touch sizeview diff --git a/examples/sizeview/glacier-sizeview.qml b/examples/sizeview/glacier-sizeview.qml new file mode 100644 index 0000000..e650921 --- /dev/null +++ b/examples/sizeview/glacier-sizeview.qml @@ -0,0 +1,247 @@ +import QtQuick 2.6 +import QtQuick.Window 2.0 +import QtQuick.Controls 1.0 +import QtQuick.Controls.Nemo 1.0 +import QtQuick.Controls.Styles.Nemo 1.0 + + +ApplicationWindow { + id: appWindow + + initialPage: Page { + id: root + + headerTools: HeaderToolsLayout { + id: tools + title: "Example" + } + + Component.onCompleted: { + console.log("iconSizeLauncher:"+Theme.iconSizeLauncher) + + console.log("itemWidthLarge:"+Theme.itemWidthLarge) + console.log("itemWidthMedium:"+Theme.itemWidthMedium) + console.log("itemWidthSmall:"+Theme.itemWidthSmall) + console.log("itemWidthExtraSmall:"+Theme.itemWidthExtraSmall) + + console.log("itemHeightHuge:"+Theme.itemHeightHuge) + console.log("itemHeightExtraLarge:"+Theme.itemHeightExtraLarge) + console.log("itemHeightLarge:"+Theme.itemHeightLarge) + console.log("itemHeightMedium:"+Theme.itemHeightMedium) + console.log("itemHeightSmall:"+Theme.itemHeightSmall) + console.log("itemHeightExtraSmall:"+Theme.itemHeightExtraSmall) + + console.log("itemSpacingHuge:"+Theme.itemSpacingHuge) + console.log("itemSpacingLarge:"+Theme.itemSpacingLarge) + console.log("itemSpacingMedium:"+Theme.itemSpacingMedium) + console.log("itemSpacingSmall:"+Theme.itemSpacingSmall) + console.log("itemSpacingExtraSmall:"+Theme.itemSpacingExtraSmall) + + console.log("fontSizeExtraLarge:"+Theme.fontSizeExtraLarge) + console.log("fontSizeLarge:"+Theme.fontSizeLarge) + console.log("fontSizeMedium:"+Theme.fontSizeMedium) + console.log("fontSizeSmall:"+Theme.fontSizeSmall) + console.log("fontSizeTiny:"+Theme.fontSizeTiny) + + console.log("fontWeightLarge:"+Theme.fontWeightLarge) + console.log("fontWeightMedium:"+Theme.fontWeightMedium) + + console.log("fontFamily:"+Theme.fontFamily) + + console.log("accentColor:"+Theme.accentColor) + console.log("fillColor:"+Theme.fillColor) + console.log("fillDarkColor:"+Theme.fillDarkColor) + console.log("textColor:"+Theme.textColor) + console.log("backgroundColor:"+Theme.backgroundColor) + console.log("backgroundAccentColor:"+Theme.backgroundAccentColor) + } + + Flickable{ + id: mainArea + height: parent.height-tools.height + width: parent.width + + contentHeight: content.height + + Column { + id: content + width: parent.width + spacing: size.dp(20) + + Label{ + text: qsTr("iconSizeLauncher:")+Theme.iconSizeLauncher + } + + Rectangle{ + color: Theme.accentColor + width: Theme.itemWidthLarge + height: Theme.itemHeightMedium + + Label{ + text: "Theme.itemWidthLarge" + } + } + + Rectangle{ + color: Theme.accentColor + width: Theme.itemWidthMedium + height: Theme.itemHeightMedium + + Label{ + text: "Theme.itemWidthMedium" + } + } + Rectangle{ + color: Theme.accentColor + width: Theme.itemWidthSmall + height: Theme.itemHeightMedium + + Label{ + text: "Theme.itemWidthSmall" + } + } + Rectangle{ + color: Theme.accentColor + width: Theme.itemWidthExtraSmall + height: Theme.itemHeightMedium + + Label{ + text: "Theme.itemWidthExtraSmall" + } + } + Rectangle{ + color: Theme.accentColor + width: Theme.itemWidthMedium + height: Theme.itemHeightHuge + + Label{ + text: "Theme.itemHeightHuge" + } + } + Rectangle{ + color: Theme.accentColor + width: Theme.itemWidthMedium + height: Theme.itemHeightExtraLarge + + Label{ + text: "Theme.itemHeightExtraLarge" + } + } + Rectangle{ + color: Theme.accentColor + width: Theme.itemWidthMedium + height: Theme.itemHeightLarge + + Label{ + text: "Theme.itemHeightLarge" + } + } + Rectangle{ + color: Theme.accentColor + width: Theme.itemWidthMedium + height: Theme.itemHeightMedium + + Label{ + text: "Theme.itemHeightMedium" + } + } + Rectangle{ + color: Theme.accentColor + width: Theme.itemWidthMedium + height: Theme.itemHeightSmall + + Label{ + text: "Theme.itemHeightSmall" + } + } + Rectangle{ + color: Theme.accentColor + width: Theme.itemWidthMedium + height: Theme.itemHeightExtraSmall + + Label{ + text: "Theme.itemHeightExtraSmall" + } + } + Row{ + Rectangle{ + width: Theme.itemSpacingHuge + height: parent.height + color: Theme.accentColor + } + Label{ + text: "Theme.itemSpacingHuge" + } + } + Row{ + Rectangle{ + width: Theme.itemSpacingLarge + height: parent.height + color: Theme.accentColor + } + Label{ + text: "Theme.itemSpacingLarge" + } + } + + Row{ + Rectangle{ + width: Theme.itemSpacingMedium + height: parent.height + color: Theme.accentColor + } + Label{ + text: "Theme.itemSpacingMedium" + } + } + + Row{ + Rectangle{ + width: Theme.itemSpacingSmall + height: parent.height + color: Theme.accentColor + } + Label{ + text: "Theme.itemSpacingSmall" + } + } + + Row{ + Rectangle{ + width: Theme.itemSpacingExtraSmall + height: parent.height + color: Theme.accentColor + } + Label{ + text: "Theme.itemSpacingExtraSmall" + } + } + + Label{ + text: "fontSizeExtraLarge" + font.pixelSize: Theme.fontSizeExtraLarge + } + + Label{ + text: "fontSizeLarge" + font.pixelSize: Theme.fontSizeLarge + } + + Label{ + text: "fontSizeMedium" + font.pixelSize: Theme.fontSizeMedium + } + + Label{ + text: "fontSizeSmall" + font.pixelSize: Theme.fontSizeSmall + } + + Label{ + text: "fontSizeTiny" + font.pixelSize: Theme.fontSizeTiny + } + } + } + } +} diff --git a/examples/sizeview/main.cpp b/examples/sizeview/main.cpp new file mode 100644 index 0000000..dc47020 --- /dev/null +++ b/examples/sizeview/main.cpp @@ -0,0 +1,35 @@ + +/* + * Copyright (C) 2017 Chupligin Sergey + * + * This library 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 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include +#include +#include +#include + +#include + +int main(int argc, char *argv[]) +{ + QGuiApplication *app = GlacierApp::app(argc, argv); + QQuickWindow *window = GlacierApp::showWindow(); + + window->setTitle(QObject::tr("Sizes view of nemocontrols")); + app->exec(); +} diff --git a/examples/sizeview/sizeview.pro b/examples/sizeview/sizeview.pro new file mode 100644 index 0000000..fb0abbb --- /dev/null +++ b/examples/sizeview/sizeview.pro @@ -0,0 +1,17 @@ +TEMPLATE = app +QT += qml quick +TARGET = glacier-sizeview +target.path = /usr/bin + +CONFIG += link_pkgconfig +LIBS += -lglacierapp +PKGCONFIG += glacierapp + + +SOURCES += \ + main.cpp + +qml.files = glacier-sizeview.qml +qml.path = /usr/share/glacier-sizeview/qml/ + +INSTALLS += target qml diff --git a/examples/touch/glacier-gallery.desktop b/examples/touch/glacier-components.desktop similarity index 100% rename from examples/touch/glacier-gallery.desktop rename to examples/touch/glacier-components.desktop diff --git a/examples/touch/touch.pro b/examples/touch/touch.pro index b054bde..685c612 100644 --- a/examples/touch/touch.pro +++ b/examples/touch/touch.pro @@ -39,7 +39,7 @@ images.path = /usr/share/glacier-components/images OTHER_FILES += $$qml.files desktop.path = /usr/share/applications -desktop.files = glacier-gallery.desktop +desktop.files = glacier-components.desktop INSTALLS += desktop target qml mainqml images diff --git a/rpm/qtquickcontrols-nemo.spec b/rpm/qtquickcontrols-nemo.spec index f5f3599..7167e72 100644 --- a/rpm/qtquickcontrols-nemo.spec +++ b/rpm/qtquickcontrols-nemo.spec @@ -74,6 +74,8 @@ desktop-file-install --delete-original \ %files examples %defattr(-,root,root,-) %{_bindir}/glacier-components +%{_bindir}/glacier-sizeview %{_datadir}/glacier-components +%{_datadir}/glacier-sizeview %{_datadir}/applications/*.desktop diff --git a/src/controls/qml/ButtonRow.qml b/src/controls/qml/ButtonRow.qml index 981ecad..fbba17a 100644 --- a/src/controls/qml/ButtonRow.qml +++ b/src/controls/qml/ButtonRow.qml @@ -67,7 +67,7 @@ Rectangle { clip: true visible: main.currentIndex > -1 width: main.currentIndex > -1 ? rowElement.children[main.currentIndex].width : 0 - x: rowElement.children[main.currentIndex].x + x: main.currentIndex > 0 ? rowElement.children[main.currentIndex].x : 0 Behavior on x { NumberAnimation { duration: 200; easing.type: Easing.OutCubic} diff --git a/src/controls/sizing.cpp b/src/controls/sizing.cpp index 6d6c025..7e48ee9 100644 --- a/src/controls/sizing.cpp +++ b/src/controls/sizing.cpp @@ -22,6 +22,15 @@ Sizing::Sizing(QObject *parent) : QObject(parent) QScreen *screen = QGuiApplication::primaryScreen(); + /*If we dont have everoment of physical size try get it from screen*/ + if(m_p_height == 0 || m_p_width == 0) { + qWarning("QT_QPA_EGLFS_PHYSICAL_WIDTH or QT_QPA_EGLFS_PHYSICAL_HEIGHT is not set! \n" + "Trying to use QScreenSize"); + QSizeF p_size = screen->physicalSize(); + m_p_height = p_size.height(); + m_p_width = p_size.width(); + qInfo() << "Set size to " << m_p_height << " x " << m_p_width; + } m_height = qMax(screen->size().width(), screen->size().height()); m_width = qMin(screen->size().width(), screen->size().height()); @@ -36,10 +45,10 @@ Sizing::Sizing(QObject *parent) : QObject(parent) if(m_width >= 2160){ //>2160 m_launcher_icon_size = 256; - }else if (m_width >= 1080){ + }else if (m_width >= 1080 && m_width < 2160){ //1080-2159 m_launcher_icon_size = 128; - }else if(m_width >= 720){ + }else if(m_width >= 720 && m_width < 1080){ //720-1079 m_launcher_icon_size = 108; }else {