diff options
Diffstat (limited to 'src-qt5')
27 files changed, 1323 insertions, 230 deletions
diff --git a/src-qt5/core/lumina-desktop-unified/extrafiles/screensavers/Grav.json b/src-qt5/core/lumina-desktop-unified/extrafiles/screensavers/Grav.json new file mode 100644 index 00000000..8d75d399 --- /dev/null +++ b/src-qt5/core/lumina-desktop-unified/extrafiles/screensavers/Grav.json @@ -0,0 +1,25 @@ +{ + "name" : { + "default" : "Grav" + }, + "description" : { + "default" : "Simulates a solar system, with a single star and planets erratically orbiting that star" + }, + "author" : { + "name" : "Zackary Welch", + "email" : "zwelch@ixsystems.com", + "website" : "https://github.com/ZackaryWelch", + "company" : "iXsystems", + "company_website" : "http://ixsystems.com" + }, + "meta" : { + "license" : "3-clause BSD", + "license_url" : "https://github.com/trueos/lumina/blob/master/LICENSE", + "copyright" : "Copyright (c) 2017, Ken Moore (ken@ixsystems.com)", + "date_created" : "20171101", + "version" : "1.0" + }, + "qml" : { + "exec" : "qml_scripts/Grav.qml" + } +} diff --git a/src-qt5/core/lumina-desktop-unified/global-includes.h b/src-qt5/core/lumina-desktop-unified/global-includes.h index 40987ad4..fbc3c4f7 100644 --- a/src-qt5/core/lumina-desktop-unified/global-includes.h +++ b/src-qt5/core/lumina-desktop-unified/global-includes.h @@ -59,10 +59,6 @@ #include <QQmlEngine> #include <QQuickImageProvider> -// C++ Backend classes for QML interface -#include <RootDesktopObject.h> -#include <ScreenObject.h> - // libLumina includes #include <LuminaX11.h> #include <LuminaXDG.h> @@ -80,6 +76,9 @@ #include <LIconCache.h> #include <LFileInfo.h> +// C++ Backend classes for QML interface +#include <RootDesktopObject.h> +#include <ScreenObject.h> //Setup any global defines (no classes or global objects: use "global-objects.h" for that) diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/PanelObject.cpp b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/PanelObject.cpp new file mode 100644 index 00000000..471da58f --- /dev/null +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/PanelObject.cpp @@ -0,0 +1,44 @@ +//=========================================== +// Lumina-desktop source code +// Copyright (c) 2017, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#include "PanelObject.h" +#include <QQmlEngine> +#include <QDebug> + +PanelObject::PanelObject(QString id, QObject *parent) : QObject(parent){ + panel_id = id; +} + +void PanelObject::RegisterType(){ + static bool done = false; + if(done){ return; } + done=true; + qmlRegisterType<PanelObject>("Lumina.Backend.PanelObject",2,0, "PanelObject"); +} + +QString PanelObject::name(){ return panel_id; } +QString PanelObject::background(){ + if(bg.isEmpty()){ return "transparent"; } + return bg; +} +int PanelObject::x(){ return geom.x(); } +int PanelObject::y(){ return geom.y(); } +int PanelObject::width(){ return geom.width(); } +int PanelObject::height(){ return geom.height(); } + +void PanelObject::setBackground(QString fileOrColor){ + if(bg!=fileOrColor){ + bg = fileOrColor; + emit backgroundChanged(); + } +} + +void PanelObject::setGeometry( QRect newgeom ){ + if(geom!=newgeom){ + geom = newgeom; + emit geomChanged(); + } +} diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/PanelObject.h b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/PanelObject.h new file mode 100644 index 00000000..a788fa07 --- /dev/null +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/PanelObject.h @@ -0,0 +1,49 @@ +//=========================================== +// Lumina-desktop source code +// Copyright (c) 2017, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +// This is the base C++ object that is used to pass Panel info to the QML classes +//=========================================== +#ifndef _LUMINA_DESKTOP_PANEL_OBJECT_H +#define _LUMINA_DESKTOP_PANEL_OBJECT_H +#include <QObject> +#include <QString> +#include <QScreen> + +class PanelObject : public QObject { + Q_OBJECT + Q_PROPERTY( QString name READ name ) + Q_PROPERTY( QString background READ background NOTIFY backgroundChanged) + Q_PROPERTY( int x READ x NOTIFY geomChanged) + Q_PROPERTY( int y READ y NOTIFY geomChanged) + Q_PROPERTY( int width READ width NOTIFY geomChanged) + Q_PROPERTY( int height READ height NOTIFY geomChanged) + +private: + QString panel_id, bg; + QRect geom; + +public: + PanelObject(QString id = "", QObject *parent = 0); + + static void RegisterType(); + + Q_INVOKABLE QString name(); + Q_INVOKABLE QString background(); + Q_INVOKABLE int x(); + Q_INVOKABLE int y(); + Q_INVOKABLE int width(); + Q_INVOKABLE int height(); + +public slots: + void setBackground(QString fileOrColor); + void setGeometry(QRect newgeom); + +signals: + void backgroundChanged(); + void geomChanged(); +}; + +#endif diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.cpp b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.cpp index 60cf56c3..5750ac2d 100644 --- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.cpp +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.cpp @@ -21,6 +21,9 @@ RootDesktopObject::~RootDesktopObject(){ } void RootDesktopObject::RegisterType(){ + static bool done = false; + if(done){ return; } + done=true; qmlRegisterType<RootDesktopObject>("Lumina.Backend.RootDesktopObject", 2, 0, "RootDesktopObject"); //Also register any types that are needed by this class ScreenObject::RegisterType(); @@ -47,6 +50,47 @@ ScreenObject* RootDesktopObject::screen(QString id){ return 0; } +QStringList RootDesktopObject::panels(){ + //qDebug() << "Request Panels:" << panel_objects.length(); + QStringList names; + for(int i=0; i<panel_objects.length(); i++){ names << panel_objects[i]->name(); } + return names; +} + +PanelObject* RootDesktopObject::panel(QString id){ + //qDebug() << "Got Panel Request:" << id; + for(int i=0; i<panel_objects.length(); i++){ + if(panel_objects[i]->name()==id){ return panel_objects[i]; } + } + return 0; +} + +QStringList RootDesktopObject::windows(){ + //qDebug() << "Request Panels:" << panel_objects.length(); + QStringList names; + for(int i=0; i<window_objects.length(); i++){ names << QString::number(window_objects[i]->id()); } + return names; +} + +NativeWindow* RootDesktopObject::window(QString id){ + //qDebug() << "Got Panel Request:" << id; + WId chk = id.toInt(); //numerical ID's in this case + for(int i=0; i<window_objects.length(); i++){ + if(window_objects[i]->id()==chk){ return window_objects[i]; } + } + return 0; +} + +void RootDesktopObject::setPanels(QList<PanelObject*> list){ + panel_objects = list; + emit panelsChanged(); +} + +void RootDesktopObject::setWindows(QList<NativeWindow*> list){ + window_objects = list; + emit windowsChanged(); +} + void RootDesktopObject::logout(){ emit startLogout(); } @@ -85,4 +129,5 @@ void RootDesktopObject::ChangeWallpaper(QString screen, QString value){ } } + // === PRIVATE === diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.h b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.h index ba586701..838b5f7d 100644 --- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.h +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.h @@ -10,6 +10,7 @@ #define _LUMINA_DESKTOP_QML_BACKEND_ROOT_DESKTOP_OBJECT_H #include <QObject> #include <QList> +#include <global-includes.h> #include "ScreenObject.h" @@ -17,6 +18,8 @@ class RootDesktopObject : public QObject{ Q_OBJECT //Define all the QML Properties here (interface between QML and the C++ methods below) Q_PROPERTY( QStringList screens READ screens NOTIFY screensChanged) + Q_PROPERTY( QStringList panels READ panels NOTIFY panelsChanged) + Q_PROPERTY( QStringList windows READ windows NOTIFY windowsChanged); public: //main contructor/destructor @@ -29,15 +32,25 @@ public: static RootDesktopObject* instance(); //QML Read Functions - QStringList screens(); + Q_INVOKABLE QStringList screens(); Q_INVOKABLE ScreenObject* screen(QString id); + Q_INVOKABLE QStringList panels(); + Q_INVOKABLE PanelObject* panel(QString id); + Q_INVOKABLE QStringList windows(); + Q_INVOKABLE NativeWindow* window(QString id); + + void setPanels(QList<PanelObject*> list); + void setWindows(QList<NativeWindow*> list); //QML Access Functions Q_INVOKABLE void logout(); Q_INVOKABLE void lockscreen(); Q_INVOKABLE void mousePositionChanged(); + private: QList<ScreenObject*> s_objects; + QList<PanelObject*> panel_objects; + QList<NativeWindow*> window_objects; public slots: void updateScreens(); //rescan/update screen objects @@ -47,6 +60,9 @@ private slots: signals: void screensChanged(); + void panelsChanged(); + void windowsChanged(); + void startLogout(); void mouseMoved(); void lockScreen(); diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/ScreenObject.cpp b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/ScreenObject.cpp index 4c1d6189..82622403 100644 --- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/ScreenObject.cpp +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/ScreenObject.cpp @@ -13,7 +13,12 @@ ScreenObject::ScreenObject(QScreen *scrn, QObject *parent) : QObject(parent){ } void ScreenObject::RegisterType(){ + static bool done = false; + if(done){ return; } + done=true; qmlRegisterType<ScreenObject>("Lumina.Backend.ScreenObject",2,0, "ScreenObject"); + //Also register any types that are needed by this class + PanelObject::RegisterType(); } QString ScreenObject::name(){ return bg_screen->name(); } @@ -29,3 +34,24 @@ void ScreenObject::setBackground(QString fileOrColor){ emit backgroundChanged(); } } + +void ScreenObject::setPanels(QList<PanelObject*> list){ + panel_objects = list; + emit panelsChanged(); +} + +//QML Read Functions +QStringList ScreenObject::panels(){ + //qDebug() << "Request Panels:" << panel_objects.length(); + QStringList names; + for(int i=0; i<panel_objects.length(); i++){ names << panel_objects[i]->name(); } + return names; +} + +PanelObject* ScreenObject::panel(QString id){ + //qDebug() << "Got Panel Request:" << id; + for(int i=0; i<panel_objects.length(); i++){ + if(panel_objects[i]->name()==id){ return panel_objects[i]; } + } + return 0; +} diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/ScreenObject.h b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/ScreenObject.h index 8076f1ae..1afff6d2 100644 --- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/ScreenObject.h +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/ScreenObject.h @@ -12,6 +12,8 @@ #include <QString> #include <QScreen> +#include "PanelObject.h" + class ScreenObject : public QObject { Q_OBJECT Q_PROPERTY( QString name READ name ) @@ -20,10 +22,12 @@ class ScreenObject : public QObject { Q_PROPERTY( int y READ y NOTIFY geomChanged) Q_PROPERTY( int width READ width NOTIFY geomChanged) Q_PROPERTY( int height READ height NOTIFY geomChanged) + Q_PROPERTY( QStringList panels READ panels NOTIFY panelsChanged) private: QScreen *bg_screen; QString bg; + QList<PanelObject*> panel_objects; public: ScreenObject(QScreen *scrn = 0, QObject *parent = 0); @@ -36,6 +40,10 @@ public: Q_INVOKABLE int y(); Q_INVOKABLE int width(); Q_INVOKABLE int height(); + Q_INVOKABLE QStringList panels(); + Q_INVOKABLE PanelObject* panel(QString id); + + void setPanels(QList<PanelObject*> list); public slots: void setBackground(QString fileOrColor); @@ -43,6 +51,7 @@ public slots: signals: void backgroundChanged(); void geomChanged(); + void panelsChanged(); }; #endif diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/src-cpp.pri b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/src-cpp.pri index 33b699da..899f4968 100644 --- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/src-cpp.pri +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/src-cpp.pri @@ -1,8 +1,9 @@ SOURCES *= $${PWD}/RootDesktopObject.cpp \ - $${PWD}/ScreenObject.cpp + $${PWD}/ScreenObject.cpp \ + $${PWD}/PanelObject.cpp HEADERS *= $${PWD}/RootDesktopObject.h \ - $${PWD}/ScreenObject.h + $${PWD}/ScreenObject.h \ + $${PWD}/PanelObject.h INCLUDEPATH *= $${PWD} - diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/Panel.qml b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/Panel.qml new file mode 100644 index 00000000..846b5b55 --- /dev/null +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/Panel.qml @@ -0,0 +1,26 @@ +//=========================================== +// Lumina-desktop source code +// Copyright (c) 2017, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +import QtQuick 2.2 +import QtQuick.Window 2.2 +import QtQuick.Controls 1 + +import Lumina.Backend.PanelObject 2.0 + +AnimatedImage { + //C++ backend object + property string screen_id + property PanelObject object + + //Normal geometries/placements + asynchronous: true + clip: true + source: object.background + x: object.x + y: object.y + width: object.width + height: object.height + } diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/RootDesktop.qml b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/RootDesktop.qml index e0381e23..c564ee42 100644 --- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/RootDesktop.qml +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/RootDesktop.qml @@ -46,11 +46,12 @@ Rectangle { //Create the context menu itself QML.ContextMenu { id: contextMenu } - //Setup the wallpapers + //Setup the screens/wallpapers Repeater{ model: RootObject.screens - QML.WallpaperImage{ + QML.Screen{ screen_id: modelData + object: RootObject.screen(modelData) z: 0+index } } diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/WallpaperImage.qml b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/Screen.qml index 1b44963f..3b83653a 100644 --- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/WallpaperImage.qml +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/Screen.qml @@ -13,7 +13,7 @@ import Lumina.Backend.ScreenObject 2.0 AnimatedImage { //C++ backend object property string screen_id - property ScreenObject object: RootObject.screen(screen_id) + property ScreenObject object //Normal geometries/placements asynchronous: true diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/src-qml.pri b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/src-qml.pri index fed18e02..ad07902a 100644 --- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/src-qml.pri +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/src-qml.pri @@ -2,7 +2,8 @@ lupdate_only{ SOURCES *= $${PWD}/RootDesktop.qml \ $${PWD}/ContextMenu.qml \ - $${PWD}/WallpaperImage.qml + $${PWD}/Screen.qml \ + $${PWD}/Panel.qml } RESOURCES *= $${PWD}/src-qml.qrc diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/src-qml.qrc b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/src-qml.qrc index ebdcc606..b0c66e20 100644 --- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/src-qml.qrc +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/src-qml.qrc @@ -2,6 +2,7 @@ <qresource prefix="qml"> <file>RootDesktop.qml</file> <file>ContextMenu.qml</file> - <file>WallpaperImage.qml</file> + <file>Screen.qml</file> + <file>Panel.qml</file> </qresource> </RCC> diff --git a/src-qt5/desktop-utils/lumina-mediaplayer/i18n/l-mediap_cs.ts b/src-qt5/desktop-utils/lumina-mediaplayer/i18n/l-mediap_cs.ts index b434a529..d1e93554 100644 --- a/src-qt5/desktop-utils/lumina-mediaplayer/i18n/l-mediap_cs.ts +++ b/src-qt5/desktop-utils/lumina-mediaplayer/i18n/l-mediap_cs.ts @@ -368,67 +368,67 @@ <message> <location filename="../../../core/libLumina/LuminaXDG.cpp" line="608"/> <source>Multimedia</source> - <translation type="unfinished"></translation> + <translation>Multimédia</translation> </message> <message> <location filename="../../../core/libLumina/LuminaXDG.cpp" line="609"/> <source>Development</source> - <translation type="unfinished"></translation> + <translation>Vývoj</translation> </message> <message> <location filename="../../../core/libLumina/LuminaXDG.cpp" line="610"/> <source>Education</source> - <translation type="unfinished"></translation> + <translation>Výuka</translation> </message> <message> <location filename="../../../core/libLumina/LuminaXDG.cpp" line="611"/> <source>Games</source> - <translation type="unfinished"></translation> + <translation>Hry</translation> </message> <message> <location filename="../../../core/libLumina/LuminaXDG.cpp" line="612"/> <source>Graphics</source> - <translation type="unfinished"></translation> + <translation>Grafika</translation> </message> <message> <location filename="../../../core/libLumina/LuminaXDG.cpp" line="613"/> <source>Network</source> - <translation type="unfinished"></translation> + <translation>Sítě</translation> </message> <message> <location filename="../../../core/libLumina/LuminaXDG.cpp" line="614"/> <source>Office</source> - <translation type="unfinished"></translation> + <translation>Kancelář</translation> </message> <message> <location filename="../../../core/libLumina/LuminaXDG.cpp" line="615"/> <source>Science</source> - <translation type="unfinished"></translation> + <translation>Věda</translation> </message> <message> <location filename="../../../core/libLumina/LuminaXDG.cpp" line="616"/> <source>Settings</source> - <translation type="unfinished">Nastavení</translation> + <translation>Nastavení</translation> </message> <message> <location filename="../../../core/libLumina/LuminaXDG.cpp" line="617"/> <source>System</source> - <translation type="unfinished"></translation> + <translation>Systém</translation> </message> <message> <location filename="../../../core/libLumina/LuminaXDG.cpp" line="618"/> <source>Utility</source> - <translation type="unfinished"></translation> + <translation>Nástroje</translation> </message> <message> <location filename="../../../core/libLumina/LuminaXDG.cpp" line="619"/> <source>Wine</source> - <translation type="unfinished"></translation> + <translation>Wine</translation> </message> <message> <location filename="../../../core/libLumina/LuminaXDG.cpp" line="620"/> <source>Unsorted</source> - <translation type="unfinished"></translation> + <translation>Různé</translation> </message> </context> </TS> diff --git a/src-qt5/desktop-utils/lumina-mediaplayer/i18n/l-mediap_da.ts b/src-qt5/desktop-utils/lumina-mediaplayer/i18n/l-mediap_da.ts index b2f87e32..f428d94e 100644 --- a/src-qt5/desktop-utils/lumina-mediaplayer/i18n/l-mediap_da.ts +++ b/src-qt5/desktop-utils/lumina-mediaplayer/i18n/l-mediap_da.ts @@ -368,67 +368,67 @@ <message> <location filename="../../../core/libLumina/LuminaXDG.cpp" line="608"/> <source>Multimedia</source> - <translation type="unfinished"></translation> + <translation>Multimedie</translation> </message> <message> <location filename="../../../core/libLumina/LuminaXDG.cpp" line="609"/> <source>Development</source> - <translation type="unfinished"></translation> + <translation>Udvikling</translation> </message> <message> <location filename="../../../core/libLumina/LuminaXDG.cpp" line="610"/> <source>Education</source> - <translation type="unfinished"></translation> + <translation>Læring</translation> </message> <message> <location filename="../../../core/libLumina/LuminaXDG.cpp" line="611"/> <source>Games</source> - <translation type="unfinished"></translation> + <translation>Spil</translation> </message> <message> <location filename="../../../core/libLumina/LuminaXDG.cpp" line="612"/> <source>Graphics</source> - <translation type="unfinished"></translation> + <translation>Grafik</translation> </message> <message> <location filename="../../../core/libLumina/LuminaXDG.cpp" line="613"/> <source>Network</source> - <translation type="unfinished"></translation> + <translation>Netværk</translation> </message> <message> <location filename="../../../core/libLumina/LuminaXDG.cpp" line="614"/> <source>Office</source> - <translation type="unfinished"></translation> + <translation>Kontor</translation> </message> <message> <location filename="../../../core/libLumina/LuminaXDG.cpp" line="615"/> <source>Science</source> - <translation type="unfinished"></translation> + <translation>Videnskab</translation> </message> <message> <location filename="../../../core/libLumina/LuminaXDG.cpp" line="616"/> <source>Settings</source> - <translation type="unfinished">Indstillinger</translation> + <translation>Indstillinger</translation> </message> <message> <location filename="../../../core/libLumina/LuminaXDG.cpp" line="617"/> <source>System</source> - <translation type="unfinished"></translation> + <translation>System</translation> </message> <message> <location filename="../../../core/libLumina/LuminaXDG.cpp" line="618"/> <source>Utility</source> - <translation type="unfinished"></translation> + <translation>Redskab</translation> </message> <message> <location filename="../../../core/libLumina/LuminaXDG.cpp" line="619"/> <source>Wine</source> - <translation type="unfinished"></translation> + <translation>Wine</translation> </message> <message> <location filename="../../../core/libLumina/LuminaXDG.cpp" line="620"/> <source>Unsorted</source> - <translation type="unfinished"></translation> + <translation>Usorteret</translation> </message> </context> </TS> diff --git a/src-qt5/desktop-utils/lumina-mediaplayer/i18n/l-mediap_hu.ts b/src-qt5/desktop-utils/lumina-mediaplayer/i18n/l-mediap_hu.ts index e9b03cec..1a2cf1aa 100644 --- a/src-qt5/desktop-utils/lumina-mediaplayer/i18n/l-mediap_hu.ts +++ b/src-qt5/desktop-utils/lumina-mediaplayer/i18n/l-mediap_hu.ts @@ -7,7 +7,7 @@ <location filename="../mainUI.ui" line="14"/> <location filename="../mainUI.cpp" line="285"/> <source>Media Player</source> - <translation type="unfinished"></translation> + <translation>Média lejátszó</translation> </message> <message> <location filename="../mainUI.ui" line="50"/> @@ -362,72 +362,4 @@ <translation type="unfinished"></translation> </message> </context> -<context> - <name>XDGDesktopList</name> - <message> - <location filename="../../../core/libLumina/LuminaXDG.cpp" line="608"/> - <source>Multimedia</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="../../../core/libLumina/LuminaXDG.cpp" line="609"/> - <source>Development</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="../../../core/libLumina/LuminaXDG.cpp" line="610"/> - <source>Education</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="../../../core/libLumina/LuminaXDG.cpp" line="611"/> - <source>Games</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="../../../core/libLumina/LuminaXDG.cpp" line="612"/> - <source>Graphics</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="../../../core/libLumina/LuminaXDG.cpp" line="613"/> - <source>Network</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="../../../core/libLumina/LuminaXDG.cpp" line="614"/> - <source>Office</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="../../../core/libLumina/LuminaXDG.cpp" line="615"/> - <source>Science</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="../../../core/libLumina/LuminaXDG.cpp" line="616"/> - <source>Settings</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="../../../core/libLumina/LuminaXDG.cpp" line="617"/> - <source>System</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="../../../core/libLumina/LuminaXDG.cpp" line="618"/> - <source>Utility</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="../../../core/libLumina/LuminaXDG.cpp" line="619"/> - <source>Wine</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="../../../core/libLumina/LuminaXDG.cpp" line="620"/> - <source>Unsorted</source> - <translation type="unfinished"></translation> - </message> -</context> </TS> diff --git a/src-qt5/desktop-utils/lumina-mediaplayer/i18n/l-mediap_lt.ts b/src-qt5/desktop-utils/lumina-mediaplayer/i18n/l-mediap_lt.ts index 8064f28a..8b7d56ba 100644 --- a/src-qt5/desktop-utils/lumina-mediaplayer/i18n/l-mediap_lt.ts +++ b/src-qt5/desktop-utils/lumina-mediaplayer/i18n/l-mediap_lt.ts @@ -280,7 +280,7 @@ <message> <location filename="../mainUI.cpp" line="105"/> <source>Please install the `pianobar` utility to enable this functionality</source> - <translation>Norėdami įjungti šį funkcionalumą, įdiekite "pianobar" paslaugų programą</translation> + <translation>Norėdami įjungti šį funkcionalumą, įdiekite "pianobar" paslaugų programą</translation> </message> <message> <location filename="../mainUI.cpp" line="109"/> @@ -368,7 +368,7 @@ <message> <location filename="../../../core/libLumina/LuminaXDG.cpp" line="608"/> <source>Multimedia</source> - <translation type="unfinished"></translation> + <translation>Multimedija</translation> </message> <message> <location filename="../../../core/libLumina/LuminaXDG.cpp" line="609"/> diff --git a/src-qt5/desktop-utils/lumina-pdf/lumina-pdf.pro b/src-qt5/desktop-utils/lumina-pdf/lumina-pdf.pro index 894d21f2..3a031067 100644 --- a/src-qt5/desktop-utils/lumina-pdf/lumina-pdf.pro +++ b/src-qt5/desktop-utils/lumina-pdf/lumina-pdf.pro @@ -18,13 +18,16 @@ include(../../core/libLumina/LuminaXDG.pri) message("Qt Modules Needed: $${QT}") SOURCES += main.cpp \ - mainUI.cpp + mainUI.cpp \ + propDialog.cpp HEADERS += mainUI.h \ CM_PrintPreviewWidget.h \ - PresentationLabel.h + PresentationLabel.h \ + PropDialog.h -FORMS += mainUI.ui +FORMS += mainUI.ui \ + propDialog.ui LIBS += -lpoppler-qt5 diff --git a/src-qt5/desktop-utils/lumina-pdf/mainUI.cpp b/src-qt5/desktop-utils/lumina-pdf/mainUI.cpp index ce2707c9..f0429b9d 100644 --- a/src-qt5/desktop-utils/lumina-pdf/mainUI.cpp +++ b/src-qt5/desktop-utils/lumina-pdf/mainUI.cpp @@ -28,7 +28,6 @@ MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI()){ this->setWindowIcon( LXDG::findIcon("application-pdf","unknown")); presentationLabel = 0; CurrentPage = 0; - ccw = 0; lastdir = QDir::homePath(); Printer = new QPrinter(); //Create the interface widgets @@ -47,6 +46,7 @@ MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI()){ //Now put the widgets into the UI this->setCentralWidget(WIDGET); WIDGET->setContextMenuPolicy(Qt::CustomContextMenu); + connect(qApp, SIGNAL(focusChanged(QWidget*, QWidget*)), this, SLOT(newFocus(QWidget*, QWidget*))); connect(WIDGET, SIGNAL(customContextMenuRequested(const QPoint&)),this, SLOT(showContextMenu(const QPoint&)) ); connect(WIDGET, SIGNAL(paintRequested(QPrinter*)), this, SLOT(paintOnWidget(QPrinter*)) ); DOC = 0; @@ -54,7 +54,7 @@ MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI()){ PrintDLG = new QPrintDialog(this); connect(PrintDLG, SIGNAL(accepted(QPrinter*)), this, SLOT(paintToPrinter(QPrinter*)) ); - connect(ui->menuStart_Presentation, SIGNAL(triggered(QAction*)), this, SLOT(slotStartPresentation(QAction*)) ); + //connect(ui->menuStart_Presentation, SIGNAL(triggered(QAction*)), this, SLOT(slotStartPresentation(QAction*)) ); //Create the other interface widgets progress = new QProgressBar(this); @@ -88,11 +88,37 @@ MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI()){ connect(ui->actionSingle_Page, SIGNAL(triggered()), WIDGET, SLOT(setSinglePageViewMode()) ); connect(ui->actionDual_Pages, SIGNAL(triggered()), WIDGET, SLOT(setFacingPagesViewMode()) ); connect(ui->actionAll_Pages, SIGNAL(triggered()), WIDGET, SLOT(setAllPagesViewMode()) ); - connect(ui->actionScroll_Mode, SIGNAL(toggled(bool)), this, SLOT(setScroll(bool)) ); + //connect(ui->actionScroll_Mode, &QAction::triggered, this, [&] { this->setScroll(true); }); + //connect(ui->actionSelect_Mode, &QAction::triggered, this, [&] { this->setScroll(false); }); connect(ui->actionZoom_In, &QAction::triggered, WIDGET, [&] { WIDGET->zoomIn(1.2); }); connect(ui->actionZoom_Out, &QAction::triggered, WIDGET, [&] { WIDGET->zoomOut(1.2); }); - connect(ui->actionRotate_Counterclockwise, &QAction::triggered, this, [&] { this->rotate(Printer, true); }); - connect(ui->actionRotate_Clockwise, &QAction::triggered, this, [&] { this->rotate(Printer, false); }); + connect(ui->actionRotate_Counterclockwise, &QAction::triggered, this, [&] { this->rotate(true); }); + connect(ui->actionRotate_Clockwise, &QAction::triggered, this, [&] { this->rotate(false); }); + connect(ui->actionZoom_In_2, &QAction::triggered, WIDGET, [&] { WIDGET->zoomIn(1.2); }); + connect(ui->actionZoom_Out_2, &QAction::triggered, WIDGET, [&] { WIDGET->zoomOut(1.2); }); + connect(ui->actionFirst_Page, SIGNAL(triggered()), this, SLOT(firstPage()) ); + connect(ui->actionPrevious_Page, SIGNAL(triggered()), this, SLOT(prevPage()) ); + connect(ui->actionNext_Page, SIGNAL(triggered()), this, SLOT(nextPage()) ); + connect(ui->actionLast_Page, SIGNAL(triggered()), this, SLOT(lastPage()) ); + connect(ui->actionProperties, SIGNAL(triggered()), this, SLOT(showInformation())); + + //int curP = WIDGET->currentPage()-1; //currentPage reports pages starting at 1 + //int lastP = numPages-1; + ui->actionFirst_Page->setText(tr("First Page")); + ui->actionPrevious_Page->setText(tr("Previous Page")); + ui->actionNext_Page->setText(tr("Next Page")); + ui->actionLast_Page->setText(tr("Last Page")); + /*ui->actionFirst_Page->setEnabled(curP!=0); + ui->actionPrevious_Page->setEnabled(curP>0); + ui->actionNext_Page->setEnabled(curP<lastP); + ui->actionLast_Page->setEnabled(curP!=lastP);*/ + + ui->actionStart_Here->setText(tr("Start Presentation (current slide)")); + connect(ui->actionStart_Here, SIGNAL(triggered()), this, SLOT(startPresentationHere()) ); + ui->actionStart_Begin->setText(tr("Start Presentation (at beginning)")); + connect(ui->actionStart_Begin, SIGNAL(triggered()), this, SLOT(startPresentationBeginning()) ); + ui->actionStop_Presentation->setText(tr("Stop Presentation")); + connect(ui->actionStop_Presentation, SIGNAL(triggered()), this, SLOT(closePresentation()) ); //Setup all the icons ui->actionPrint->setIcon( LXDG::findIcon("document-print","")); @@ -104,14 +130,31 @@ MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI()){ ui->actionDual_Pages->setIcon(LXDG::findIcon("format-view-grid-small","")); ui->actionAll_Pages->setIcon(LXDG::findIcon("format-view-grid-large","")); ui->actionScroll_Mode->setIcon(LXDG::findIcon("cursor-pointer","")); + ui->actionSelect_Mode->setIcon(LXDG::findIcon("cursor-text","")); ui->actionZoom_In->setIcon(LXDG::findIcon("zoom-in","")); ui->actionZoom_Out->setIcon(LXDG::findIcon("zoom-out","")); + ui->actionZoom_In_2->setIcon(LXDG::findIcon("zoom-in","")); + ui->actionZoom_Out_2->setIcon(LXDG::findIcon("zoom-out","")); ui->actionRotate_Counterclockwise->setIcon(LXDG::findIcon("object-rotate-left","")); ui->actionRotate_Clockwise->setIcon(LXDG::findIcon("object-rotate-right","")); + ui->actionFirst_Page->setIcon(LXDG::findIcon("go-first","")); + ui->actionPrevious_Page->setIcon(LXDG::findIcon("go-previous","")); + ui->actionNext_Page->setIcon(LXDG::findIcon("go-next","")); + ui->actionLast_Page->setIcon(LXDG::findIcon("go-last","")); + ui->actionStart_Here->setIcon(LXDG::findIcon("media-playback-start-circled","")); + ui->actionStart_Begin->setIcon(LXDG::findIcon("presentation-play","")); + ui->actionStop_Presentation->setIcon(LXDG::findIcon("media-playback-stop-circled","")); + ui->actionBookmarks->setIcon(LXDG::findIcon("bookmark-new","")); + ui->actionFind->setIcon(LXDG::findIcon("edit-find","")); + ui->actionFind_Next->setIcon(LXDG::findIcon("edit-find-next","")); + ui->actionFind_Previous->setIcon(LXDG::findIcon("edit-find-prev","")); + ui->actionProperties->setIcon(LXDG::findIcon("dialog-information","")); + ui->actionSettings->setIcon(LXDG::findIcon("document-properties","")); //Now set the default state of the menu's and actions - ui->menuStart_Presentation->setEnabled(false); ui->actionStop_Presentation->setEnabled(false); + ui->actionStart_Here->setEnabled(false); + ui->actionStart_Begin->setEnabled(false); } MainUI::~MainUI(){ @@ -256,7 +299,8 @@ void MainUI::startPresentation(bool atStart){ presentationLabel->showFullScreen(); ui->actionStop_Presentation->setEnabled(true); - ui->menuStart_Presentation->setEnabled(false); + ui->actionStart_Here->setEnabled(false); + ui->actionStart_Begin->setEnabled(false); updateClock(); clockAct->setVisible(true); clockTimer->start(); @@ -296,7 +340,8 @@ void MainUI::endPresentation(){ if(presentationLabel==0 || !presentationLabel->isVisible()){ return; } //not in presentation mode presentationLabel->hide(); //just hide this (no need to re-create the label for future presentations) ui->actionStop_Presentation->setEnabled(false); - ui->menuStart_Presentation->setEnabled(true); + ui->actionStart_Here->setEnabled(true); + ui->actionStart_Begin->setEnabled(true); clockTimer->stop(); clockAct->setVisible(false); this->releaseKeyboard(); @@ -311,8 +356,6 @@ void MainUI::startLoadingPages(QPrinter *printer){ progress->setValue(0); progAct->setVisible(true); QRectF pageSize = printer->pageRect(QPrinter::DevicePixel); - printer->setPageSize(QPageSize(QSize(pageSize.width()*2, pageSize.height()*2))); - qDebug() << "Starting size" << pageSize.size(); QSize DPI(printer->resolution(),printer->resolution()); /*qDebug() << "Screen Resolutions:"; QList<QScreen*> screens = QApplication::screens(); @@ -321,49 +364,46 @@ void MainUI::startLoadingPages(QPrinter *printer){ }*/ for(int i=0; i<numPages; i++){ //qDebug() << " - Kickoff page load:" << i; - this->ccw = 0; + //this->ccw = 0; QtConcurrent::run(this, &MainUI::loadPage, i, DOC, this, DPI, pageSize.size()); } } void MainUI::slotPageLoaded(int page){ + Q_UNUSED(page); //qDebug() << "Page Loaded:" << page; int finished = loadingHash.keys().length(); if(finished == numPages){ progAct->setVisible(false); QTimer::singleShot(0, WIDGET, SLOT(updatePreview())); - qDebug() << "Updating"; + //qDebug() << "Updating"; ui->actionStop_Presentation->setEnabled(false); - ui->menuStart_Presentation->setEnabled(true); + ui->actionStart_Here->setEnabled(true); + ui->actionStart_Begin->setEnabled(true); }else{ progress->setValue(finished); } } -void MainUI::slotStartPresentation(QAction *act){ +/*void MainUI::slotStartPresentation(QAction *act){ startPresentation(act == ui->actionAt_Beginning); -} +}*/ void MainUI::paintOnWidget(QPrinter *PRINTER){ if(DOC==0){ return; } - //this->show(); - qDebug() << "Painting"; - qDebug() << numPages << loadingHash.keys().length(); if(loadingHash.keys().length() != numPages){ startLoadingPages(PRINTER); return; } + //Increase the resolution of the page to match the image to prevent downscaling + PRINTER->setPageSize(QPageSize(PRINTER->pageRect().size()*2)); + qDebug() << PRINTER->pageRect().size() << loadingHash[0].size(); QPainter painter(PRINTER); - for(int i=0; i<numPages; i++){ - if(i != 0){ PRINTER->newPage(); } //this is the start of the next page (not needed for first) - if(loadingHash.contains(i)){ painter.drawImage(0,0, loadingHash[i].scaled(PRINTER->pageRect().size(), Qt::KeepAspectRatio, Qt::SmoothTransformation)); qDebug() << PRINTER->pageRect().size();} - else{ painter.drawImage(0,0, QImage()); } - if(ccw != 0) { - QTransform transform; - transform.rotate((ccw-1) ? 270 : 90); - painter.setTransform(transform); - //painter.rotate((ccw-1) ? 270 : 90); - } - } + for(int i=0; i<numPages; i++){ + if(i != 0){ PRINTER->newPage(); } //this is the start of the next page (not needed for first) + if(loadingHash.contains(i)){ painter.drawImage(0,0, loadingHash[i].scaled(PRINTER->pageRect().size(), Qt::KeepAspectRatio, Qt::SmoothTransformation)); } + else{ painter.drawImage(0,0, QImage()); } + } WIDGET->setContextMenuPolicy(Qt::CustomContextMenu); + loadingHash.clear(); } void MainUI::paintToPrinter(QPrinter *PRINTER){ @@ -403,7 +443,6 @@ void MainUI::paintToPrinter(QPrinter *PRINTER){ } } //qDebug() << "Final Page Range:" << pageCount; - //return; //Generate the sizing information for the printer QSize sz(PRINTER->pageRect().width(), PRINTER->pageRect().height()); bool landscape = PRINTER->orientation()==QPrinter::Landscape; @@ -443,32 +482,85 @@ void MainUI::setScroll(bool tog) { }else{ QApplication::setOverrideCursor(Qt::IBeamCursor); } - //WIDGET-> } -void MainUI::rotate(QPrinter *printer, bool ccw) { - QRectF pageSize = printer->pageRect(QPrinter::DevicePixel); - QSize dpi(printer->resolution(),printer->resolution()); - this->ccw = ccw+1; - for(int i=0; i < numPages; i++) - QtConcurrent::run(this, &MainUI::loadPage, i, DOC, this, dpi, pageSize.size()); +void MainUI::rotate(bool ccw) { + for(int i = 0; i < numPages; i++) { + QImage image = loadingHash[i]; + //Setup a rotation matrix that rotates 90 degrees clockwise or counterclockwise + QMatrix matrix = (ccw) ? QMatrix(0, -1, 1, 0, 0, 0) : QMatrix(0, 1, -1, 0, 0, 0); + image = image.transformed(matrix, Qt::SmoothTransformation); + //Updates the image in the hash + loadingHash.insert(i, image); + } + //Rotates the page as well as the image + WIDGET->setOrientation((WIDGET->orientation() == QPrinter::Landscape) ? + QPrinter::Portrait : QPrinter::Landscape); + WIDGET->updatePreview(); } void MainUI::updateContextMenu(){ contextMenu->clear(); - int curP = WIDGET->currentPage()-1; //currentPage reports pages starting at 1 - int lastP = numPages-1; - contextMenu->addSection( QString(tr("Page %1 of %2")).arg(QString::number(curP+1), QString::number(lastP+1) ) ); - contextMenu->addAction(tr("Next Page"), this, SLOT(nextPage()))->setEnabled(curP<lastP); - contextMenu->addAction(tr("Previous Page"), this, SLOT(prevPage()))->setEnabled( curP>0 ); + contextMenu->addSection( QString(tr("Page %1 of %2")).arg(QString::number(WIDGET->currentPage()), + QString::number(numPages) ) ); + contextMenu->addAction(ui->actionPrevious_Page); + contextMenu->addAction(ui->actionNext_Page); contextMenu->addSeparator(); - contextMenu->addAction(tr("First Page"), this, SLOT(firstPage()))->setEnabled(curP!=0); - contextMenu->addAction(tr("Last Page"), this, SLOT(lastPage()))->setEnabled(curP!=lastP); + contextMenu->addAction(ui->actionFirst_Page); + contextMenu->addAction(ui->actionLast_Page); contextMenu->addSeparator(); if(presentationLabel==0 || !presentationLabel->isVisible()){ - contextMenu->addAction(tr("Start Presentation (current slide)"), this, SLOT(startPresentationHere()) ); - contextMenu->addAction(tr("Start Presentation (at beginning)"), this, SLOT(startPresentationBeginning()) ); + contextMenu->addAction(ui->actionStart_Begin); + contextMenu->addAction(ui->actionStart_Here); + }else{ + contextMenu->addAction(ui->actionStop_Presentation); + } +} + +void MainUI::keyPressEvent(QKeyEvent *event){ + //See if this is one of the special hotkeys and act appropriately + bool inPresentation = (presentationLabel!=0); + if( event->key()==Qt::Key_Escape || event->key()==Qt::Key_Backspace){ + if(inPresentation){ endPresentation(); } + }else if(event->key()==Qt::Key_Right || event->key()==Qt::Key_Space || + event->key()==Qt::Key_PageDown){ + nextPage(); + }else if(event->key()==Qt::Key_Left || event->key()==Qt::Key_PageUp){ + prevPage(); + }else if(event->key()==Qt::Key_Home){ + firstPage(); + }else if(event->key()==Qt::Key_End){ + lastPage(); + }else if(event->key()==Qt::Key_F11){ + if(inPresentation){ endPresentation(); } + else{ startPresentationHere(); } + }else if(event->key() == Qt::Key_Up) { + //Scroll the widget up + }else if(event->key() == Qt::Key_Down) { + //Scroll the widget down + /*qDebug() << "Send Wheel Event"; + QWheelEvent wEvent( WIDGET->mapFromGlobal(QCursor::pos()), QCursor::pos(),QPoint(0,0), QPoint(0,30), 0, Qt::Vertical, Qt::LeftButton, Qt::NoModifier); + QApplication::sendEvent(WIDGET, &wEvent);*/ }else{ - contextMenu->addAction(tr("Stop Presentation"), this, SLOT(closePresentation()) ); + QMainWindow::keyPressEvent(event); } } + +void MainUI::wheelEvent(QWheelEvent *event) { + //Scroll the window according to the mouse wheel + QMainWindow::wheelEvent(event); +} + +void MainUI::newFocus(QWidget *oldW, QWidget *newW) { + Q_UNUSED(oldW); + //qDebug() << "NEW: " << newW << "OLD: " << oldW; + if(newW and newW != this) { + newW->setFocusPolicy(Qt::NoFocus); + this->setFocus(); + } +} + +void MainUI::showInformation() { + PROPDIALOG = new PropDialog(DOC); + PROPDIALOG->show(); +} diff --git a/src-qt5/desktop-utils/lumina-pdf/mainUI.h b/src-qt5/desktop-utils/lumina-pdf/mainUI.h index 527bcb2a..18b3d231 100644 --- a/src-qt5/desktop-utils/lumina-pdf/mainUI.h +++ b/src-qt5/desktop-utils/lumina-pdf/mainUI.h @@ -21,6 +21,7 @@ #include <poppler/qt5/poppler-qt5.h> #include "PresentationLabel.h" +#include "propDialog.h" namespace Ui{ class MainUI; @@ -34,16 +35,13 @@ public: void loadFile(QString path); - private: Poppler::Document *DOC; QPrintPreviewWidget *WIDGET; Ui::MainUI *ui; + PropDialog *PROPDIALOG; QPrinter* Printer; QPrintDialog *PrintDLG; - - int ccw; - QString lastdir; //Other Interface elements @@ -72,7 +70,7 @@ private: private slots: void startLoadingPages(QPrinter *printer); void slotPageLoaded(int); - void slotStartPresentation(QAction *act); + //void slotStartPresentation(QAction *act); //Simplification routines void nextPage(){ ShowPage( WIDGET->currentPage() ); } //currentPage() starts at 1 rather than 0 @@ -82,8 +80,9 @@ private slots: void startPresentationHere(){ startPresentation(false); } void startPresentationBeginning(){ startPresentation(true); } void closePresentation(){ endPresentation(); } + void showInformation(); - + void newFocus(QWidget*, QWidget*); void paintOnWidget(QPrinter *PRINTER); void paintToPrinter(QPrinter *PRINTER); @@ -96,51 +95,13 @@ private slots: void updateContextMenu(); void setScroll(bool); - void rotate(QPrinter*, bool); + void rotate(bool); signals: void PageLoaded(int); protected: - void keyPressEvent(QKeyEvent *event){ - //See if this is one of the special hotkeys and act appropriately - //qDebug() << "Got Key Press:"; - bool inPresentation = (presentationLabel!=0); - if(!inPresentation){ - //Alternate functionality when **not** in presentation mode - /*if(event->key()==Qt::Key_Down){ - qDebug() << "Send Wheel Event"; - QWheelEvent event( WIDGET->mapFromGlobal(QCursor::pos()), QCursor::pos(),QPoint(0,0), QPoint(0,30), 0, Qt::Vertical, Qt::LeftButton, Qt::NoModifier); - QApplication::sendEvent(WIDGET, &event); - //WIDGET->scrollDown(); - return; - }else if(event->key()==Qt::Key_Up){ - return; - }*/ - } - - if( event->key()==Qt::Key_Escape || event->key()==Qt::Key_Backspace){ - //qDebug() << " - Escape/Backspace"; - if(inPresentation){ endPresentation(); } - }else if(event->key()==Qt::Key_Right || event->key()==Qt::Key_Down || event->key()==Qt::Key_Space || event->key()==Qt::Key_PageDown){ - //qDebug() << " - Right/Down/Spacebar" << inPresentation; - nextPage(); - }else if(event->key()==Qt::Key_Left || event->key()==Qt::Key_Up || event->key()==Qt::Key_PageUp){ - //qDebug() << " - Left/Up"; - prevPage(); - }else if(event->key()==Qt::Key_Home){ - //qDebug() << " - Home"; - firstPage(); - }else if(event->key()==Qt::Key_End){ - //qDebug() << " - End"; - lastPage(); - }else if(event->key()==Qt::Key_F11){ - //qDebug() << " - F11"; - if(inPresentation){ endPresentation(); } - else{ startPresentationHere(); } - }else{ - QMainWindow::keyPressEvent(event); - } - } + void keyPressEvent(QKeyEvent*); + void wheelEvent(QWheelEvent*); }; #endif diff --git a/src-qt5/desktop-utils/lumina-pdf/mainUI.ui b/src-qt5/desktop-utils/lumina-pdf/mainUI.ui index 20a79cf2..70d3167a 100644 --- a/src-qt5/desktop-utils/lumina-pdf/mainUI.ui +++ b/src-qt5/desktop-utils/lumina-pdf/mainUI.ui @@ -33,19 +33,14 @@ <addaction name="separator"/> <addaction name="actionClose"/> <addaction name="separator"/> - <addaction name="actionPDF_Info"/> + <addaction name="actionProperties"/> </widget> <widget class="QMenu" name="menuPresentation"> <property name="title"> <string>&Presentation</string> </property> - <widget class="QMenu" name="menuStart_Presentation"> - <property name="title"> - <string>Start Presentation</string> - </property> - <addaction name="actionAt_Beginning"/> - </widget> - <addaction name="menuStart_Presentation"/> + <addaction name="actionStart_Begin"/> + <addaction name="actionStart_Here"/> <addaction name="actionStop_Presentation"/> </widget> <widget class="QMenu" name="menuSettings"> @@ -59,6 +54,7 @@ <addaction name="actionSettings"/> <addaction name="separator"/> <addaction name="actionScroll_Mode"/> + <addaction name="actionSelect_Mode"/> </widget> <widget class="QMenu" name="menuView"> <property name="title"> @@ -105,6 +101,9 @@ <addaction name="actionSingle_Page"/> <addaction name="actionDual_Pages"/> <addaction name="actionAll_Pages"/> + <addaction name="separator"/> + <addaction name="actionZoom_In_2"/> + <addaction name="actionZoom_Out_2"/> </widget> <action name="actionOpen_PDF"> <property name="text"> @@ -170,9 +169,9 @@ <string>All Pages</string> </property> </action> - <action name="actionAt_Beginning"> + <action name="actionStart_Begin"> <property name="text"> - <string>At Beginning</string> + <string>Start Presentation (at beginning)</string> </property> </action> <action name="actionStop_Presentation"> @@ -230,9 +229,9 @@ <string>Last Page</string> </property> </action> - <action name="actionPDF_Info"> + <action name="actionProperties"> <property name="text"> - <string>PDF Info</string> + <string>Properties</string> </property> </action> <action name="actionBookmarks"> @@ -250,29 +249,41 @@ <string>Rotate Clockwise</string> </property> </action> - <action name="actionSelect_Mode"> + <action name="actionScroll_Mode"> <property name="checkable"> - <bool>true</bool> + <bool>false</bool> </property> <property name="checked"> + <bool>false</bool> + </property> + <property name="enabled"> <bool>true</bool> </property> <property name="text"> - <string>Select Mode</string> + <string>Scroll Mode</string> </property> </action> - <action name="actionScroll_Mode"> - <property name="checkable"> - <bool>true</bool> + <action name="actionZoom_Out_2"> + <property name="text"> + <string/> </property> - <property name="checked"> - <bool>false</bool> + </action> + <action name="actionZoom_In_2"> + <property name="text"> + <string/> </property> - <property name="enabled"> - <bool>true</bool> + </action> + <action name="actionStart_Here"> + <property name="text"> + <string>Start Presentation (current slide)</string> + </property> + </action> + <action name="actionSelect_Mode"> + <property name="checkable"> + <bool>false</bool> </property> <property name="text"> - <string>Scroll Mode</string> + <string>Select Mode</string> </property> </action> </widget> diff --git a/src-qt5/desktop-utils/lumina-pdf/propDialog.cpp b/src-qt5/desktop-utils/lumina-pdf/propDialog.cpp new file mode 100644 index 00000000..6dbdee69 --- /dev/null +++ b/src-qt5/desktop-utils/lumina-pdf/propDialog.cpp @@ -0,0 +1,54 @@ +//=========================================== +// Lumina Desktop source code +// Copyright (c) 2017, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== + +#include "propDialog.h" +#include "ui_propDialog.h" + +#include <LuminaXDG.h> + +PropDialog::PropDialog(Poppler::Document *DOC) : QDialog(), ui(new Ui::PropDialog()){ + this->setWindowTitle(tr("PDF Information")); + this->setWindowIcon( LXDG::findIcon("dialog-information","unknown")); + int verMa, verMi; + QString version; + QSize size = DOC->page(0)->pageSize(); + + //Grab the version + DOC->getPdfVersion(&verMa, &verMi); + version = QString::number(verMa)+"."+QString::number(verMi); + + ui->setupUi(this); + + //Setup translations + ui->titleL->setText(tr("Title:")); + ui->subjectL->setText(tr("Subject:")); + ui->authorL->setText(tr("Author:")); + ui->creatorL->setText(tr("Creator:")); + ui->producerL->setText(tr("Producer:")); + ui->keywordsL->setText(tr("Keywords:")); + ui->createdL->setText(tr("Created:")); + ui->modifiedL->setText(tr("Modified:")); + ui->versionL->setText(tr("PDF Version:")); + ui->sizeL->setText(tr("Page Size:")); + ui->numberL->setText(tr("Number of Pages:")); + ui->saveButton->setText(tr("Save")); + ui->closeButton->setText(tr("Close")); + + //Fill the text boxes with information from the document + ui->titleE->setText(DOC->title()); + ui->subjectE->setText(DOC->subject()); + ui->authorE->setText(DOC->author()); + ui->creatorE->setText(DOC->creator()); + ui->producerE->setText(DOC->producer()); + ui->keywordE->setText(DOC->keywords()); + ui->createdEntry->setText(DOC->creationDate().toString(Qt::TextDate)); + ui->modifiedEntry->setText(DOC->modificationDate().toString(Qt::TextDate)); + ui->versionL->setText(ui->versionL->text()+version); + ui->sizeL->setText(ui->sizeL->text()+QString::number(size.height())+ + ", "+QString::number(size.width())); + ui->numberL->setText(ui->numberL->text()+QString::number(DOC->numPages())); +} diff --git a/src-qt5/desktop-utils/lumina-pdf/propDialog.h b/src-qt5/desktop-utils/lumina-pdf/propDialog.h new file mode 100644 index 00000000..be67ebd3 --- /dev/null +++ b/src-qt5/desktop-utils/lumina-pdf/propDialog.h @@ -0,0 +1,25 @@ +//=========================================== +// Lumina Desktop source code +// Copyright (c) 2017, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#ifndef _LUMINA_PDF_VIEWER_PROP_DIALOG_H +#define _LUMINA_PDF_VIEWER_PROP_DIALOG_H + +#include <QDialog> +#include <poppler/qt5/poppler-qt5.h> + +namespace Ui{ + class PropDialog; +}; + +class PropDialog : public QDialog { + Q_OBJECT + public: + PropDialog(Poppler::Document*); + + private: + Ui::PropDialog *ui; +}; +#endif diff --git a/src-qt5/desktop-utils/lumina-pdf/propDialog.ui b/src-qt5/desktop-utils/lumina-pdf/propDialog.ui new file mode 100644 index 00000000..ad995473 --- /dev/null +++ b/src-qt5/desktop-utils/lumina-pdf/propDialog.ui @@ -0,0 +1,601 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>PropDialog</class> + <widget class="QDialog" name="PropDialog"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>400</width> + <height>300</height> + </rect> + </property> + <property name="windowTitle"> + <string>PDF Information</string> + </property> + <widget class="QTextEdit" name="titleE"> + <property name="geometry"> + <rect> + <x>100</x> + <y>30</y> + <width>291</width> + <height>16</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>256</width> + <height>16</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>512</width> + <height>16</height> + </size> + </property> + <property name="acceptDrops"> + <bool>false</bool> + </property> + <property name="verticalScrollBarPolicy"> + <enum>Qt::ScrollBarAlwaysOff</enum> + </property> + <property name="horizontalScrollBarPolicy"> + <enum>Qt::ScrollBarAlwaysOff</enum> + </property> + <property name="sizeAdjustPolicy"> + <enum>QAbstractScrollArea::AdjustToContents</enum> + </property> + <property name="readOnly"> + <bool>false</bool> + </property> + <property name="acceptRichText"> + <bool>false</bool> + </property> + </widget> + <widget class="QLabel" name="titleL"> + <property name="geometry"> + <rect> + <x>20</x> + <y>30</y> + <width>71</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>Title:</string> + </property> + </widget> + <widget class="QLabel" name="subjectL"> + <property name="geometry"> + <rect> + <x>20</x> + <y>50</y> + <width>71</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>Subject:</string> + </property> + </widget> + <widget class="QLabel" name="authorL"> + <property name="geometry"> + <rect> + <x>20</x> + <y>70</y> + <width>71</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>Author:</string> + </property> + </widget> + <widget class="QLabel" name="creatorL"> + <property name="geometry"> + <rect> + <x>20</x> + <y>90</y> + <width>71</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>Creator:</string> + </property> + </widget> + <widget class="QLabel" name="createdL"> + <property name="geometry"> + <rect> + <x>20</x> + <y>150</y> + <width>81</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>Created: </string> + </property> + </widget> + <widget class="QLabel" name="producerL"> + <property name="geometry"> + <rect> + <x>20</x> + <y>110</y> + <width>71</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>Producer:</string> + </property> + </widget> + <widget class="QLabel" name="keywordsL"> + <property name="geometry"> + <rect> + <x>20</x> + <y>130</y> + <width>71</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>Keywords:</string> + </property> + </widget> + <widget class="QTextEdit" name="subjectE"> + <property name="geometry"> + <rect> + <x>100</x> + <y>50</y> + <width>291</width> + <height>16</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>256</width> + <height>16</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>512</width> + <height>16</height> + </size> + </property> + <property name="acceptDrops"> + <bool>false</bool> + </property> + <property name="verticalScrollBarPolicy"> + <enum>Qt::ScrollBarAlwaysOff</enum> + </property> + <property name="horizontalScrollBarPolicy"> + <enum>Qt::ScrollBarAlwaysOff</enum> + </property> + <property name="sizeAdjustPolicy"> + <enum>QAbstractScrollArea::AdjustToContents</enum> + </property> + <property name="readOnly"> + <bool>false</bool> + </property> + <property name="acceptRichText"> + <bool>false</bool> + </property> + </widget> + <widget class="QTextEdit" name="creatorE"> + <property name="geometry"> + <rect> + <x>100</x> + <y>90</y> + <width>291</width> + <height>16</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>256</width> + <height>16</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>512</width> + <height>16</height> + </size> + </property> + <property name="acceptDrops"> + <bool>false</bool> + </property> + <property name="verticalScrollBarPolicy"> + <enum>Qt::ScrollBarAlwaysOff</enum> + </property> + <property name="horizontalScrollBarPolicy"> + <enum>Qt::ScrollBarAlwaysOff</enum> + </property> + <property name="sizeAdjustPolicy"> + <enum>QAbstractScrollArea::AdjustToContents</enum> + </property> + <property name="readOnly"> + <bool>false</bool> + </property> + <property name="acceptRichText"> + <bool>false</bool> + </property> + </widget> + <widget class="QTextEdit" name="authorE"> + <property name="geometry"> + <rect> + <x>100</x> + <y>70</y> + <width>291</width> + <height>16</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>256</width> + <height>16</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>512</width> + <height>16</height> + </size> + </property> + <property name="acceptDrops"> + <bool>false</bool> + </property> + <property name="verticalScrollBarPolicy"> + <enum>Qt::ScrollBarAlwaysOff</enum> + </property> + <property name="horizontalScrollBarPolicy"> + <enum>Qt::ScrollBarAlwaysOff</enum> + </property> + <property name="sizeAdjustPolicy"> + <enum>QAbstractScrollArea::AdjustToContents</enum> + </property> + <property name="readOnly"> + <bool>false</bool> + </property> + <property name="acceptRichText"> + <bool>false</bool> + </property> + </widget> + <widget class="QTextEdit" name="keywordE"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="geometry"> + <rect> + <x>100</x> + <y>130</y> + <width>291</width> + <height>16</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>256</width> + <height>16</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>512</width> + <height>16</height> + </size> + </property> + <property name="acceptDrops"> + <bool>false</bool> + </property> + <property name="autoFillBackground"> + <bool>false</bool> + </property> + <property name="frameShape"> + <enum>QFrame::StyledPanel</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Sunken</enum> + </property> + <property name="verticalScrollBarPolicy"> + <enum>Qt::ScrollBarAlwaysOff</enum> + </property> + <property name="horizontalScrollBarPolicy"> + <enum>Qt::ScrollBarAlwaysOff</enum> + </property> + <property name="sizeAdjustPolicy"> + <enum>QAbstractScrollArea::AdjustToContents</enum> + </property> + <property name="readOnly"> + <bool>false</bool> + </property> + <property name="acceptRichText"> + <bool>false</bool> + </property> + </widget> + <widget class="QTextEdit" name="producerE"> + <property name="geometry"> + <rect> + <x>100</x> + <y>110</y> + <width>291</width> + <height>16</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>256</width> + <height>16</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>512</width> + <height>16</height> + </size> + </property> + <property name="acceptDrops"> + <bool>false</bool> + </property> + <property name="verticalScrollBarPolicy"> + <enum>Qt::ScrollBarAlwaysOff</enum> + </property> + <property name="horizontalScrollBarPolicy"> + <enum>Qt::ScrollBarAlwaysOff</enum> + </property> + <property name="sizeAdjustPolicy"> + <enum>QAbstractScrollArea::AdjustToContents</enum> + </property> + <property name="readOnly"> + <bool>false</bool> + </property> + <property name="acceptRichText"> + <bool>false</bool> + </property> + </widget> + <widget class="QLabel" name="versionL"> + <property name="geometry"> + <rect> + <x>20</x> + <y>200</y> + <width>311</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>PDF Version:</string> + </property> + </widget> + <widget class="QLabel" name="sizeL"> + <property name="geometry"> + <rect> + <x>20</x> + <y>220</y> + <width>301</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>Page Size:</string> + </property> + </widget> + <widget class="QLabel" name="numberL"> + <property name="geometry"> + <rect> + <x>20</x> + <y>240</y> + <width>321</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>Number of Pages:</string> + </property> + </widget> + <widget class="QLabel" name="modifiedL"> + <property name="geometry"> + <rect> + <x>20</x> + <y>170</y> + <width>81</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>Modified: </string> + </property> + </widget> + <widget class="QTextEdit" name="createdEntry"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="geometry"> + <rect> + <x>100</x> + <y>150</y> + <width>291</width> + <height>16</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>256</width> + <height>16</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>512</width> + <height>16</height> + </size> + </property> + <property name="acceptDrops"> + <bool>false</bool> + </property> + <property name="autoFillBackground"> + <bool>false</bool> + </property> + <property name="frameShape"> + <enum>QFrame::StyledPanel</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Sunken</enum> + </property> + <property name="verticalScrollBarPolicy"> + <enum>Qt::ScrollBarAlwaysOff</enum> + </property> + <property name="horizontalScrollBarPolicy"> + <enum>Qt::ScrollBarAlwaysOff</enum> + </property> + <property name="sizeAdjustPolicy"> + <enum>QAbstractScrollArea::AdjustToContents</enum> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + <property name="acceptRichText"> + <bool>false</bool> + </property> + </widget> + <widget class="QTextEdit" name="modifiedEntry"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="geometry"> + <rect> + <x>100</x> + <y>170</y> + <width>291</width> + <height>16</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>256</width> + <height>16</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>512</width> + <height>16</height> + </size> + </property> + <property name="acceptDrops"> + <bool>false</bool> + </property> + <property name="autoFillBackground"> + <bool>false</bool> + </property> + <property name="frameShape"> + <enum>QFrame::StyledPanel</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Sunken</enum> + </property> + <property name="verticalScrollBarPolicy"> + <enum>Qt::ScrollBarAlwaysOff</enum> + </property> + <property name="horizontalScrollBarPolicy"> + <enum>Qt::ScrollBarAlwaysOff</enum> + </property> + <property name="sizeAdjustPolicy"> + <enum>QAbstractScrollArea::AdjustToContents</enum> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + <property name="acceptRichText"> + <bool>false</bool> + </property> + </widget> + <widget class="QPushButton" name="saveButton"> + <property name="geometry"> + <rect> + <x>230</x> + <y>270</y> + <width>80</width> + <height>23</height> + </rect> + </property> + <property name="text"> + <string>Save</string> + </property> + </widget> + <widget class="QPushButton" name="closeButton"> + <property name="geometry"> + <rect> + <x>310</x> + <y>270</y> + <width>80</width> + <height>23</height> + </rect> + </property> + <property name="text"> + <string>Close</string> + </property> + <property name="autoDefault"> + <bool>true</bool> + </property> + <property name="default"> + <bool>true</bool> + </property> + <property name="flat"> + <bool>false</bool> + </property> + </widget> + </widget> + <resources/> + <connections/> +</ui> diff --git a/src-qt5/src-qml/test/Grav.qml b/src-qt5/src-qml/test/Grav.qml new file mode 100644 index 00000000..d7404a56 --- /dev/null +++ b/src-qt5/src-qml/test/Grav.qml @@ -0,0 +1,164 @@ +import QtQuick 2.7 +import QtQuick.Window 2.2 +import QtGraphicalEffects 1.0 + +Rectangle { + id : canvas + anchors.fill: parent + width: Screen.width + height: Screen.height + color: "black" + + //TODO Add orbital trails option + //TODO Fix jitteryness and start position + //TODO Make orbits more extreme + + //Between 5 and 15 planets, read from settings + property int planets: Math.round(( Math.random() * 10 ) + 5 ) + property int cx: Math.round(width/2) + property int cy: Math.round(height/2) + + //Create planets + Repeater { + id: planetRepeater + model: planets + + Rectangle { + id : index + parent: canvas + + //Creates random distance for elipse + property double c: Math.random() * 250 + property double b: Math.random() * 150 + c + property double a: Math.sqrt(b*b+c*c) + //Random angle of rotation + property double th: Math.random() * Math.PI + property var pathX: createPathX() + property var pathY: createPathY() + property var testArray: createTest() + + //Calculates starting position + x: Math.round(cx + a * Math.cos(th)) + y: Math.round(cy + b * Math.sin(th)) + + //Planet size between 14 and 32 pixels + width: Math.round(1.75 * (((Math.random() * 10) + 8 ))) + height: width + + //Make each rectangle look circular + radius: width / 2 + + //Give each planet a random color, semi-transparent + color: Qt.rgba(Math.random(), Math.random(), Math.random(), 0.5) + + PathAnimation on x{ + loops: Animation.Infinite + duration: 200 + path: Path { + startX: x + startY: y + PathCurve { x: pathX; y: pathY } + } + } + + NumberAnimation { + + } + + function createTest() { + var test = [] + for(var i = 1; i <= 200; i++) { + test.push(PathCurve { x: pathX[i]; y: pathY[i] }) + } + return test + } + + function createPathX() { + var pathX = [] + for(var i = 1; i <= 200; i++) { + pathX.push(cx+a*Math.cos(2*Math.PI*(i/200.0))*Math.cos(th) - b*Math.sin(2*Math.PI*(i/200.0))*Math.sin(th)) + } + return pathX + } + + function createPathY() { + var pathY = [] + for(var i = 1; i <= 200; i++) { + pathY.push(cy+a*Math.cos(2*Math.PI*(i/200.0))*Math.sin(th) + b*Math.sin(2*Math.PI*(i/200.0))*Math.cos(th)) + } + return pathY + } + + /*Timer { + //Each planet updates between 1ms and 51ms (smaller times=faster) + interval: Math.round(Math.random() * 50 ) + 1 + repeat: true + running: true + property int time: 0 + + onTriggered: { + //Parametric equation that calculates the position of the general ellipse. Completes a loop ever 314 cycles. Credit to + x = cx+a*Math.cos(2*Math.PI*(time/314.0))*Math.cos(th) - b*Math.sin(2*Math.PI*(time/314.0))*Math.sin(th) + y = cy+a*Math.cos(2*Math.PI*(time/314.0))*Math.sin(th) + b*Math.sin(2*Math.PI*(time/314.0))*Math.cos(th) + time++; + + //Move a planet 80 pixels away from the sun if the planet is too close + if(x > cx && Math.abs(cx-x) < 80) { + x+=80 + }else if(x < cx && Math.abs(cx-x) < 80) { + x-=80 + } + + if(y > cy && Math.abs(cy-y) < 80) { + y+=80 + }else if(y < cy && Math.abs(cy-y) < 80) { + y-=80 + } + } + }*/ + } + } + + //Create the star + Rectangle{ + id: star + parent: canvas + + //Centers in star in the center of the canvas, with an offset to center the animation + x: cx - 30 + y: cy - 30 + + width: 60 + height: width + + //Create the wobble animation + SequentialAnimation on height { + loops: Animation.Infinite + PropertyAnimation { duration: 2000; to: 90 } + PropertyAnimation { duration: 2000; to: 60 } + } + + SequentialAnimation on width { + loops: Animation.Infinite + PropertyAnimation { duration: 2000; to: 90 } + PropertyAnimation { duration: 2000; to: 60 } + } + + color: "black" + radius: width / 2 + + //Creates a radial gradient to make the star look cool + RadialGradient { + anchors.fill: parent + gradient: Gradient { + GradientStop { position:0 ;color: Qt.rgba(0,0,0,0)} + GradientStop { position:0.18 ;color: Qt.rgba(0,0,0,0)} + GradientStop { position:0.2 ;color: Qt.rgba(0.32,0.47,0.30,0.13)} + GradientStop { position:0.3 ;color: Qt.rgba(0.62,0.92,0.58,0.25)} + GradientStop { position:0.4 ;color: Qt.rgba(1.00,0.93,0.59,0.51)} + GradientStop { position:0.5 ;color: Qt.rgba(0,0,0,0)} + } + } + + } +} diff --git a/src-qt5/src-qml/test/Test.qml b/src-qt5/src-qml/test/Test.qml new file mode 100644 index 00000000..a2407b6c --- /dev/null +++ b/src-qt5/src-qml/test/Test.qml @@ -0,0 +1,7 @@ +import QtQuick 2.7 + +Rectangle { + id : canvas + anchors.fill: parent + color: "black" +} |