diff options
Diffstat (limited to '')
-rw-r--r-- | .gitignore | 34 | ||||
-rwxr-xr-x | asteroid-stopwatch | bin | 383590 -> 0 bytes | |||
-rw-r--r--[-rwxr-xr-x] | asteroid-stopwatch.desktop | 4 | ||||
-rw-r--r--[-rwxr-xr-x] | asteroid-stopwatch.pro | 23 | ||||
-rwxr-xr-x | deploy.sh | 18 | ||||
-rw-r--r-- | main.cpp | 40 | ||||
-rw-r--r--[-rwxr-xr-x] | main.qml | 119 | ||||
-rw-r--r--[-rwxr-xr-x] | resources.qrc | 0 | ||||
-rwxr-xr-x | src/main.cpp | 46 | ||||
-rwxr-xr-x | src/src.pri | 2 |
10 files changed, 63 insertions, 223 deletions
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 Binary files differdeleted file mode 100755 index 46b290d..0000000 --- a/asteroid-stopwatch +++ /dev/null diff --git a/asteroid-stopwatch.desktop b/asteroid-stopwatch.desktop index 31845a3..4f80516 100755..100644 --- 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 index 4ad802b..387ddf3 100755..100644 --- 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 <revestflo@gmail.com> + * + * 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 <http://www.gnu.org/licenses/>. + */ + +#include <QtQml> +#include <QtQuick/QQuickView> +#include <QtCore/QString> +#include <QScreen> +#include <QtGui/QGuiApplication> + +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<QQuickWindow *>(topLevel); + if(!window) { + qWarning("Error: Your root item has to be a Window."); + return -1; + } + window->showFullScreen(); + return app.exec(); +} @@ -1,6 +1,4 @@ /* - * Qt Quick Controls Asteroid - User interface components for AsteroidOS - * * Copyright (C) 2015 Tim Süberkrüb <tim.sueberkrueb@web.de> * 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" @@ -201,28 +131,9 @@ 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 index 5f6483a..5f6483a 100755..100644 --- a/resources.qrc +++ b/resources.qrc 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 <revestflo@gmail.com> -// 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 <QtQml> -#include <QtQuick/QQuickView> -#include <QtCore/QString> -#include <QScreen> - -#ifndef QT_NO_WIDGETS -#include <QtWidgets/QApplication> -#else -#include <QtGui/QGuiApplication> -#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<QQuickWindow *>(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 |