From cdcf5e8496b51091f9d71a6a52a588a97686c49d Mon Sep 17 00:00:00 2001 From: Florent Revest Date: Sun, 20 Dec 2015 17:50:25 +0100 Subject: Removes the colorful settings and sanitize a little bit the code --- .gitignore | 34 ------------- asteroid-stopwatch | Bin 383590 -> 0 bytes asteroid-stopwatch.desktop | 4 +- asteroid-stopwatch.pro | 23 +++------ deploy.sh | 18 ------- main.cpp | 40 +++++++++++++++ main.qml | 119 +++++---------------------------------------- resources.qrc | 0 src/main.cpp | 46 ------------------ src/src.pri | 2 - 10 files changed, 63 insertions(+), 223 deletions(-) delete mode 100644 .gitignore delete mode 100755 asteroid-stopwatch mode change 100755 => 100644 asteroid-stopwatch.desktop mode change 100755 => 100644 asteroid-stopwatch.pro delete mode 100755 deploy.sh create mode 100644 main.cpp mode change 100755 => 100644 main.qml mode change 100755 => 100644 resources.qrc delete mode 100755 src/main.cpp delete mode 100755 src/src.pri diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 61bf962..0000000 --- a/.gitignore +++ /dev/null @@ -1,34 +0,0 @@ -# C++ objects and libs - -*.slo -*.lo -*.o -*.a -*.la -*.lai -*.so -*.dll -*.dylib - -# Qt-es - -/.qmake.cache -/.qmake.stash -*.pro.user -*.pro.user.* -*.qbs.user -*.qbs.user.* -*.moc -moc_*.cpp -qrc_*.cpp -ui_*.h -Makefile* -*-build-* - -# QtCreator - -*.autosave - -# QtCreator Qml -*.qmlproject.user -*.qmlproject.user.* diff --git a/asteroid-stopwatch b/asteroid-stopwatch deleted file mode 100755 index 46b290d..0000000 Binary files a/asteroid-stopwatch and /dev/null differ diff --git a/asteroid-stopwatch.desktop b/asteroid-stopwatch.desktop old mode 100755 new mode 100644 index 31845a3..4f80516 --- a/asteroid-stopwatch.desktop +++ b/asteroid-stopwatch.desktop @@ -2,6 +2,6 @@ Type=Application Name=Stopwatch Categories=Applications; -Exec=env QT_QUICK_CONTROLS_STYLE=Nemo /usr/bin/asteroid-stopwatch -Icon=icon-app-texteditor +Exec=env QT_QUICK_CONTROLS_STYLE=Asteroid /usr/bin/asteroid-stopwatch +Icon=clock X-Desktop-File-Install-Version=0.20 diff --git a/asteroid-stopwatch.pro b/asteroid-stopwatch.pro old mode 100755 new mode 100644 index 4ad802b..387ddf3 --- a/asteroid-stopwatch.pro +++ b/asteroid-stopwatch.pro @@ -1,22 +1,15 @@ TEMPLATE = app -QT += qml quick xml svg +QT += widgets qml quick xml svg QTPLUGIN += qsvg -TARGET = asteroid-stopwatch -target.path = /usr/bin/ - -qtHaveModule(widgets){ - QT += widgets -} - -include(src/src.pri) +SOURCES += main.cpp +RESOURCES += resources.qrc OTHER_FILES += main.qml -RESOURCES += \ - resources.qrc - -INSTALLS += target +TARGET = asteroid-stopwatch +target.path = /usr/bin/ -desktop.path = /usr/share/applications desktop.files = asteroid-stopwatch.desktop -INSTALLS += desktop +desktop.path = /usr/share/applications + +INSTALLS += target desktop diff --git a/deploy.sh b/deploy.sh deleted file mode 100755 index be342cb..0000000 --- a/deploy.sh +++ /dev/null @@ -1,18 +0,0 @@ -#! /bin/bash -# asteroid-stopwatch deploy script -# (C) Copyright 2015 by Tim Süberkrüb -set -e -echo "Setup environment setup for armv7a-vfp-neon-oe-linux-gnueabi ..." -source /usr/local/oecore-x86_64/environment-setup-armv7a-vfp-neon-oe-linux-gnueabi -echo "Running qmake ..." -qmake -echo "Running make ..." -make -echo "Deploying binary ..." -adb push asteroid-stopwatch /usr/bin/asteroid-stopwatch -echo "Deploying desktop file ..." -adb push asteroid-stopwatch.desktop /usr/share/applications/asteroid-stopwatch.desktop -echo "Keep display on ..." -adb shell mcetool -D on -echo "Running application ..." -adb shell env QT_QUICK_CONTROLS_STYLE=Nemo XDG_RUNTIME_DIR=/tmp /usr/bin/asteroid-stopwatch --platform wayland-egl diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..3b88dd7 --- /dev/null +++ b/main.cpp @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2015 - Florent Revest + * + * This program 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 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 General Public License + * along with this program. If not, see . + */ + +#include +#include +#include +#include +#include + +int main(int argc, char *argv[]) +{ + QGuiApplication app(argc, argv); + QScreen* sc = app.primaryScreen(); + if(sc) { + sc->setOrientationUpdateMask(Qt::LandscapeOrientation | Qt::PortraitOrientation | Qt::InvertedLandscapeOrientation | Qt::InvertedPortraitOrientation); + } + QQmlApplicationEngine engine(QUrl("qrc:/main.qml")); + QObject *topLevel = engine.rootObjects().value(0); + QQuickWindow *window = qobject_cast(topLevel); + if(!window) { + qWarning("Error: Your root item has to be a Window."); + return -1; + } + window->showFullScreen(); + return app.exec(); +} diff --git a/main.qml b/main.qml old mode 100755 new mode 100644 index 898848f..98adb39 --- a/main.qml +++ b/main.qml @@ -1,6 +1,4 @@ /* - * Qt Quick Controls Asteroid - User interface components for AsteroidOS - * * Copyright (C) 2015 Tim Süberkrüb * Part of this code is based on "Stopwatch" (https://github.com/baleboy/stopwatch) * Copyright (C) 2011 Francesco Balestrieri @@ -23,8 +21,6 @@ import QtQuick 2.4 import QtGraphicalEffects 1.0 import QtQuick.Controls 1.3 import org.asteroid.controls 1.0 -import Qt.labs.settings 1.0 - Application { id: app @@ -34,14 +30,6 @@ Application { property var previousTime property int elapsed: 0 - property bool colorful: true - - Settings { - id: settings - property alias colorful: app.colorful - } - - function zeroPad(n) { return (n < 10 ? "0" : "") + n } @@ -55,64 +43,6 @@ Application { Math.floor((mod % 1000) / 100) } - LayerStack { - id: watchLayerStack - - Layer { - id: settingsLayer - Rectangle { - anchors.fill: parent - color: "black" - - Flickable { - anchors.fill: parent - interactive: false - - contentWidth: parent.width - contentHeight: childrenRect.height - - Column { - spacing: Units.dp(16) - anchors { - fill: parent - topMargin: Units.dp(16) - } - - Label { - anchors.horizontalCenter: parent.horizontalCenter - text: "Settings" - font.pixelSize: Units.dp(16) - color: "white" - } - - Row { - anchors.horizontalCenter: parent.horizontalCenter - spacing: Units.dp(8) - - CheckBox { - id: checkboxColorful - checked: app.colorful - onCheckedChanged: app.colorful = checked - } - - Label { - text: "Colorful" - font.pixelSize: Units.dp(12) - color: "white" - } - - } - - } - - } - - } - - } - - } - Item { anchors.fill: parent @@ -123,7 +53,6 @@ Application { state: "zero" Behavior on color { - ColorAnimation { duration: 200 } @@ -140,6 +69,10 @@ Application { target: mainPage color: "white" } + PropertyChanges { + target: elapsedLabel + color: "black" + } }, State { name: "running" @@ -149,40 +82,37 @@ Application { } PropertyChanges { target: mainPage - color: app.colorful ? "#5469d5" : "white" + color: "#5469d5" } }, State { name: "paused" PropertyChanges { target: iconButton - iconName: "play" - } + iconName: "play" } PropertyChanges { target: mainPage - color: app.colorful ? "#d55469" : "white" + color: "#d55469" } } ] Label { + id: elapsedLabel anchors.centerIn: parent - color: mainPage.state === "zero" || !app.colorful ? "black" : "white" + color: mainPage.state === "zero" || "white" text: toTimeString(elapsed) - font.pixelSize: Units.dp(16) + font.pixelSize: Units.dp(17) } MouseArea { anchors.fill: parent - - onClicked: { - iconButton.clicked(); - } + onClicked: iconButton.clicked(); } IconButton { id: resetButton - iconColor: app.colorful ? "white" : "black" + iconColor: "white" iconName: "refresh-empty" visible: mainPage.state === "paused" @@ -200,29 +130,10 @@ Application { } } - IconButton { - id: settingsButton - iconColor: "black" - iconName: "cog" - visible: mainPage.state === "zero" - - hovered: false - - anchors { - horizontalCenter: parent.horizontalCenter - topMargin: Units.dp(8) - top: parent.top - } - - onClicked: { - settingsLayer.show(); - } - } - IconButton { id: iconButton iconName: "play" - iconColor: mainPage.state === "zero" || !app.colorful ? "black" : "white" + iconColor: mainPage.state === "zero" || "white" hovered: false @@ -247,8 +158,6 @@ Application { } } } - - } Timer { @@ -266,7 +175,5 @@ Application { elapsed += delta } } - } - } diff --git a/resources.qrc b/resources.qrc old mode 100755 new mode 100644 diff --git a/src/main.cpp b/src/main.cpp deleted file mode 100755 index ec8f2de..0000000 --- a/src/main.cpp +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright © 2015 Florent Revest -// This work is free. You can redistribute it and/or modify it under the -// terms of the Do What The Fuck You Want To Public License, Version 2, -// as published by Sam Hocevar. See http://www.wtfpl.net/ for more details. - -#include -#include -#include -#include - -#ifndef QT_NO_WIDGETS -#include -#else -#include -#endif - -QT_BEGIN_NAMESPACE - -#ifndef QT_NO_WIDGETS -#define Application QApplication -#else -#define Application QGuiApplication -#endif - -int main(int argc, char *argv[]) -{ - Application app(argc, argv); - QScreen* sc = app.primaryScreen(); - if(sc){ - sc->setOrientationUpdateMask(Qt::LandscapeOrientation - | Qt::PortraitOrientation - | Qt::InvertedLandscapeOrientation - | Qt::InvertedPortraitOrientation); - } - QQmlApplicationEngine engine(QUrl("qrc:/main.qml")); - QObject *topLevel = engine.rootObjects().value(0); - QQuickWindow *window = qobject_cast(topLevel); - if ( !window ) { - qWarning("Error: Your root item has to be a Window."); - return -1; - } - window->showFullScreen(); - return app.exec(); -} - -QT_END_NAMESPACE diff --git a/src/src.pri b/src/src.pri deleted file mode 100755 index 66d903e..0000000 --- a/src/src.pri +++ /dev/null @@ -1,2 +0,0 @@ -SOURCES += \ - $$PWD/main.cpp -- cgit v1.2.3-70-g09d2