Skip to content

Commit

Permalink
Merge pull request #78 from neochapay/master
Browse files Browse the repository at this point in the history
Varios fixing of sizing and installinig
  • Loading branch information
locusf authored Dec 25, 2019
2 parents 518abad + dc78d00 commit 4738726
Show file tree
Hide file tree
Showing 9 changed files with 315 additions and 5 deletions.
2 changes: 1 addition & 1 deletion examples/examples.pro
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
TEMPLATE=subdirs

SUBDIRS+= touch
SUBDIRS+= touch sizeview
247 changes: 247 additions & 0 deletions examples/sizeview/glacier-sizeview.qml
Original file line number Diff line number Diff line change
@@ -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
}
}
}
}
}
35 changes: 35 additions & 0 deletions examples/sizeview/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

/*
* Copyright (C) 2017 Chupligin Sergey <[email protected]>
*
* 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 <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQuickWindow>
#include <QDebug>

#include <glacierapp.h>

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();
}
17 changes: 17 additions & 0 deletions examples/sizeview/sizeview.pro
Original file line number Diff line number Diff line change
@@ -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
File renamed without changes.
2 changes: 1 addition & 1 deletion examples/touch/touch.pro
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions rpm/qtquickcontrols-nemo.spec
Original file line number Diff line number Diff line change
Expand Up @@ -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

2 changes: 1 addition & 1 deletion src/controls/qml/ButtonRow.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
13 changes: 11 additions & 2 deletions src/controls/sizing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -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 {
Expand Down

0 comments on commit 4738726

Please sign in to comment.