aboutsummaryrefslogtreecommitdiff
path: root/src-qt5
diff options
context:
space:
mode:
authorKen Moore <ken@ixsystems.com>2017-10-09 22:28:38 -0400
committerKen Moore <ken@ixsystems.com>2017-10-09 22:28:38 -0400
commit4723568e850cf593b2212054a766c5d7b6051739 (patch)
tree97c6eeaa89a32666a95b12d31cd59eff960637e4 /src-qt5
parentRead the default app desktop files from full path to fix settings persistance... (diff)
downloadlumina-4723568e850cf593b2212054a766c5d7b6051739.tar.gz
lumina-4723568e850cf593b2212054a766c5d7b6051739.tar.bz2
lumina-4723568e850cf593b2212054a766c5d7b6051739.zip
Remove the src-glwidgets tree. No longer needed since it has been replaced by the src-qml source tree.
Diffstat (limited to 'src-qt5')
-rw-r--r--src-qt5/src-glwidgets/gltest/colorchange.h30
-rw-r--r--src-qt5/src-glwidgets/gltest/main.cpp52
-rwxr-xr-xsrc-qt5/src-glwidgets/gltest/testbin58272 -> 0 bytes
-rw-r--r--src-qt5/src-glwidgets/gltest/test.pro9
-rw-r--r--src-qt5/src-glwidgets/glw-base.cpp120
-rw-r--r--src-qt5/src-glwidgets/glw-base.h49
-rw-r--r--src-qt5/src-glwidgets/glw-widget.cpp115
-rw-r--r--src-qt5/src-glwidgets/glw-widget.h63
-rw-r--r--src-qt5/src-glwidgets/glwidgets.pri7
9 files changed, 0 insertions, 445 deletions
diff --git a/src-qt5/src-glwidgets/gltest/colorchange.h b/src-qt5/src-glwidgets/gltest/colorchange.h
deleted file mode 100644
index aad01f05..00000000
--- a/src-qt5/src-glwidgets/gltest/colorchange.h
+++ /dev/null
@@ -1,30 +0,0 @@
-#include <QDebug>
-#include <QApplication>
-#include <QTimer>
-#include <QColor>
-
-#include "../glw-base.h"
-
-class colorchange : public QObject{
- Q_OBJECT
-private:
- GLW_Base *base;
- QTimer *timer;
-
-public slots:
- void toggle(){
- static bool current = false;
- base->setBackgroundColor( current ? QColor(Qt::blue) : QColor(Qt::red));
- current = !current;
- }
-
-public:
- colorchange(GLW_Base *parent) : QObject(){
- base = parent;
- timer = new QTimer(this);
- timer->setInterval(5000);
- connect(timer, SIGNAL(timeout()), this, SLOT(toggle()) );
- timer->start();
- }
-
-};
diff --git a/src-qt5/src-glwidgets/gltest/main.cpp b/src-qt5/src-glwidgets/gltest/main.cpp
deleted file mode 100644
index efcebea1..00000000
--- a/src-qt5/src-glwidgets/gltest/main.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-#include <QDebug>
-#include <QApplication>
-#include <QTimer>
-#include <QColor>
-#include <QPropertyAnimation>
-#include "../glw-base.h"
-#include "../glw-widget.h"
-
-#include "colorchange.h"
-
-int main(int argc, char** argv){
-
- QSurfaceFormat fmt;
- fmt.setRenderableType(QSurfaceFormat::OpenGL); //OpenGL, OpenGLES, OpenVG
- fmt.setSwapBehavior(QSurfaceFormat::DoubleBuffer);
- QSurfaceFormat::setDefaultFormat(fmt);
-
- QApplication A(argc,argv);
-
- qDebug() << "Creating base widget";
- GLW_Base base;
- qDebug() << "Resize base widget";
- base.resize(1024,768);
- qDebug() << "Create Other widgets";
- GLW_Widget wgt1(&base);
- wgt1.setGLBase(&base);
- wgt1.setGeometry(50,50,50,50);
- wgt1.setDraggable(true);
- GLW_Widget wgt(&base);
- wgt.setGLBase(&base);
- wgt.setGeometry(75,50,50,50);
- QPropertyAnimation anim(&wgt);
- anim.setTargetObject(&wgt);
- anim.setPropertyName("geometry");
- //anim.setStartValue(QRect(-50,-50,50,50));
- //anim.setEndValue(QRect(200,200,50,50));
- anim.setStartValue(QRect(base.width()/2,base.height()/2,0,0));
- anim.setEndValue(QRect(0,0,base.width(),base.height()));
- anim.setDuration(1500);
- anim.setLoopCount(-1);
- anim.start();
- /*QPushButton but(&base);
- but.setText("button");
- but.setGeometry(100,100,50,50);
- but.setStyleSheet("background: rgba(0,150,0,125)");*/
- colorchange CC(&base);
- qDebug() << "Start Event loop";
- base.show();
- int ret = A.exec();
- qDebug() << " - Finished";
- return ret;
-}
diff --git a/src-qt5/src-glwidgets/gltest/test b/src-qt5/src-glwidgets/gltest/test
deleted file mode 100755
index 3ba6f8db..00000000
--- a/src-qt5/src-glwidgets/gltest/test
+++ /dev/null
Binary files differ
diff --git a/src-qt5/src-glwidgets/gltest/test.pro b/src-qt5/src-glwidgets/gltest/test.pro
deleted file mode 100644
index cba315c3..00000000
--- a/src-qt5/src-glwidgets/gltest/test.pro
+++ /dev/null
@@ -1,9 +0,0 @@
-QT = core gui widgets
-
-TARGET = test
-
-SOURCES += main.cpp
-
-HEADERS += colorchange.h
-
-include(../glwidgets.pri);
diff --git a/src-qt5/src-glwidgets/glw-base.cpp b/src-qt5/src-glwidgets/glw-base.cpp
deleted file mode 100644
index 4065f70f..00000000
--- a/src-qt5/src-glwidgets/glw-base.cpp
+++ /dev/null
@@ -1,120 +0,0 @@
-//===========================================
-// Lumina-desktop source code
-// Copyright (c) 2017, Ken Moore
-// Available under the 3-clause BSD license
-// See the LICENSE file for full details
-//===========================================
-#include "glw-base.h"
-#include "glw-widget.h"
-#include <QPaintEngine>
-#include <QDebug>
-#include <QOpenGLContext>
-#include <QOpenGLFunctions>
-#include <QOpenGLPaintDevice>
-
-GLW_Base::GLW_Base(QWidget *parent, Qt::WindowFlags f) : QOpenGLWidget(parent,f){
- bg_color = QColor(Qt::black);
- mouse_over_child = 0;
- qDebug() << "Canvas supports threaded OpenGL:" << this->context()->supportsThreadedOpenGL();
- qDebug() << " - globally:" << QOpenGLContext::globalShareContext()->supportsThreadedOpenGL();
-}
-
-GLW_Base::~GLW_Base(){
-
-}
-
-QWidget * GLW_Base::mouseOverWidget(){
- return mouse_over_child;
-}
-
-// --- PUBLIC SLOTS ---
-void GLW_Base::setBackgroundColor(QColor color){
- bg_color = color;
- this->update(); //repaint the entire widget (just in case you can see through the image)
-
-}
-
-void GLW_Base::setBackground(QRect geom, QImage img){
- QPainter P(&bg_img);
- P.drawImage(geom, img);
- this->update(geom);
-}
-
-void GLW_Base::repaintArea(QRect rect){
- this->update(rect);
-}
-
-void GLW_Base::setMouseOverWidget(QWidget *child){
- mouse_over_child = child;
-}
-
-// --- PROTECTED ---
-void GLW_Base::mouseMoveEvent(QMouseEvent *ev){
- mouse_over_child = 0; //reset this flag - mouse is over the base right now
- QWidget::mouseMoveEvent(ev);
-}
-
-void GLW_Base::resizeEvent(QResizeEvent *ev){
- QOpenGLWidget::resizeEvent(ev);
- if(!bg_img.isNull()){
- bg_img = bg_img.scaled(ev->size(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
- }
- emit BaseResized();
-}
-
-/*void GLW_Base::paintEvent(QPaintEvent *ev){
- QOpenGLWidget::paintEvent(ev);
-}*/
-
-void GLW_Base::paintGL(){
-
- //Setup the OpenGL stuff
- QOpenGLFunctions *f = this->context()->functions();
- f->glViewport(0, 0, width(), height());
- f->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-
- GLfloat vertices[] = {
- 0.0f, 0.707f,
- -0.5f, -0.5f,
- 0.5f, -0.5f
- };
-
- f->glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, vertices);
- f->glEnableVertexAttribArray(0);
- f->glDrawArrays(GL_TRIANGLES, 0, 3);
- f->glDisableVertexAttribArray(0);
- glDrawPixels(bg_img.width(), bg_img.height(), GL_RGBA, GL_UNSIGNED_BYTE, bg_img.bits());
-
- QRect rect = QRect(QPoint(0,0), this->size());
- //Prepare the image to be painted
- QImage img(this->size(), QImage::Format_RGBA8888);
- QPainter painter;
- painter.begin(&img);
- painter.fillRect(rect, bg_color);
- painter.end();
-
- //Now do any QPainter drawing
- /*QOpenGLPaintDevice device(rect.size());
- QStylePainter painter;
- painter.begin(&device, this);
- //qDebug() << "Paint Engine type:" << painter.paintEngine()->type();
- painter.setClipRegion(rect);
- //Fill in the background color first
- painter.fillRect(rect, bg_color);
- //Now paint any background image over that
- painter.drawImage(rect, bg_img, rect, Qt::AutoColor | Qt::PreferDither | Qt::NoOpaqueDetection);
- //Now find any children widgets and paint them if they are in that area
- QObjectList child = this->children(); //Note: This is returned in stacking order (lowest -> highest)
- for(int i=0; i<child.length(); i++){
- if( !child[i]->isWidgetType() ){ continue; } //not a widget
- GLW_Widget *glww = qobject_cast<GLW_Widget*>(child[i]);
- if(glww!=0){
- if(!rect.intersected(glww->widgetRect()).isNull()){
- glww->paintYourself(&painter, &rect);
- glww->paintChildren(&painter,&rect);
- }
- }
- }
- painter.end();
- update();*/
-}
diff --git a/src-qt5/src-glwidgets/glw-base.h b/src-qt5/src-glwidgets/glw-base.h
deleted file mode 100644
index ecc5bc3a..00000000
--- a/src-qt5/src-glwidgets/glw-base.h
+++ /dev/null
@@ -1,49 +0,0 @@
-//===========================================
-// 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_OPENGL_WIDGETS_BASE_H
-#define _LUMINA_OPENGL_WIDGETS_BASE_H
-
-#include <QOpenGLWidget>
-#include <QImage>
-#include <QPaintEvent>
-#include <QPainter>
-#include <QResizeEvent>
-#include <QStylePainter>
-
-class GLW_Base : public QOpenGLWidget{
- Q_OBJECT
-private:
- QColor bg_color;
- QImage bg_img;
- QWidget *mouse_over_child;
-
-public:
- GLW_Base(QWidget *parent = Q_NULLPTR, Qt::WindowFlags f = Qt::WindowFlags());
- ~GLW_Base();
-
- QWidget * mouseOverWidget();
-
-private slots:
-
-public slots:
- void setBackgroundColor(QColor color);
- void setBackground(QRect geom, QImage img);
- void repaintArea(QRect);
- void setMouseOverWidget(QWidget*);
-
-signals:
- void BaseResized();
-
-protected:
- void mouseMoveEvent(QMouseEvent *ev);
- void resizeEvent(QResizeEvent *ev);
- //void paintEvent(QPaintEvent *ev);
- //void initializeGL();
- void paintGL();
-};
-
-#endif
diff --git a/src-qt5/src-glwidgets/glw-widget.cpp b/src-qt5/src-glwidgets/glw-widget.cpp
deleted file mode 100644
index e8d255b9..00000000
--- a/src-qt5/src-glwidgets/glw-widget.cpp
+++ /dev/null
@@ -1,115 +0,0 @@
-//===========================================
-// Lumina-desktop source code
-// Copyright (c) 2017, Ken Moore
-// Available under the 3-clause BSD license
-// See the LICENSE file for full details
-//===========================================
-#include "glw-widget.h"
-#include <QDebug>
-
-// --- PUBLIC ---
-GLW_Widget::GLW_Widget(QWidget *parent, Qt::WindowFlags f) : QWidget(parent, f){
- glw_base = 0;
- draggable = false;
- drag_offset = QPoint();
-}
-
-GLW_Widget::~GLW_Widget(){
-
-}
-
-QRect GLW_Widget::widgetRect(){
- QPoint pos = this->mapTo(glw_base, QPoint(0,0));
- return QRect(pos, this->size());
-}
-
-bool GLW_Widget::mouseOverWidget(){
- return (glw_base->mouseOverWidget()==this);
-}
-
-void GLW_Widget::setGLBase(GLW_Base *base){
- if(glw_base!=0){ this->disconnect(glw_base, SLOT(repaintArea(QRect))); }
- glw_base=base;
- connect(this, SIGNAL(repaintArea(QRect)), glw_base, SLOT(repaintArea(QRect)) );
-}
-
-void GLW_Widget::paintYourself(QStylePainter *painter, const QRect *prect){
- QRect rect = widgetRect();
- rect = prect->intersected(rect);
- QColor color( mouseOverWidget() ? Qt::gray : Qt::yellow);
- //if(this->windowOpacity()!=1.0){ qDebug() << "Opacity:" << this->windowOpacity(); }
- //color.setAlpha( qRound(this->windowOpacity()*255) );
- color.setAlpha( 125);
- painter->fillRect(rect, color);
-}
-
-void GLW_Widget::paintChildren(QStylePainter *painter, const QRect *prect){
- QObjectList child = this->children(); //Note: This is returned in stacking order (lowest -> highest)
- for(int i=0; i<child.length(); i++){
- if( !child[i]->isWidgetType() ){ continue; } //not a widget
- GLW_Widget *glww = qobject_cast<GLW_Widget*>(child[i]);
- if(glww!=0){
- if( !prect->intersected(glww->widgetRect()).isNull() ){
- glww->paintYourself(painter, prect);
- glww->paintChildren(painter,prect);
- }
- }
- }
-}
-
-
-// --- PROTECTED ---
-void GLW_Widget::enterEvent(QEvent*){
- if(!mouseOverWidget()){ glw_base->setMouseOverWidget(this); }
- this->update();
-}
-
-void GLW_Widget::leaveEvent(QEvent*){
- if(mouseOverWidget()){ glw_base->setMouseOverWidget(0); }
- this->update();
-}
-
-void GLW_Widget::mousePressEvent(QMouseEvent *ev){
- if(!draggable){ QWidget::mousePressEvent(ev); return; }
- if(ev->button()==Qt::LeftButton){
- drag_offset = ev->pos();
- }
-}
-
-void GLW_Widget::mouseReleaseEvent(QMouseEvent *ev){
- if(!draggable){ QWidget::mouseReleaseEvent(ev); return; }
- if(ev->button()==Qt::LeftButton){
- if(drag_offset!=ev->pos()){ emit doneDragging(); }
- drag_offset = QPoint(); } //reset offset
-}
-
-void GLW_Widget::mouseMoveEvent(QMouseEvent *ev){
- if(!mouseOverWidget()){ glw_base->setMouseOverWidget(this); }
- if(!draggable){ QWidget::mouseMoveEvent(ev); return; }
- if(!drag_offset.isNull()){
- this->move( this->mapTo(glw_base, ev->pos()-drag_offset) );
- }
-}
-
-
-void GLW_Widget::moveEvent(QMoveEvent *ev){
- QRect oldgeom = QRect(ev->oldPos(), this->size());
- QRect newgeom = QRect(ev->pos(), this->size());
- emit repaintArea( oldgeom.united(newgeom) );
-}
-
-void GLW_Widget::resizeEvent(QResizeEvent *ev){
- if(glw_base==0){ return; }
- QPoint pos = this->mapTo(glw_base, QPoint(0,0));
- QSize sz = ev->oldSize();
- if(ev->size().width() > sz.width()){ sz.setWidth(ev->size().width()); }
- if(ev->size().height() > sz.height()){ sz.setHeight(ev->size().height()); }
- emit repaintArea(QRect(pos, sz));
-}
-
-void GLW_Widget::paintEvent(QPaintEvent *ev){
- //qDebug() << "Got paint event:" << ev->rect();
- QPoint pos = this->mapTo(glw_base, ev->rect().topLeft());
- emit repaintArea(QRect(pos, ev->rect().size()) );
- return;
-}
diff --git a/src-qt5/src-glwidgets/glw-widget.h b/src-qt5/src-glwidgets/glw-widget.h
deleted file mode 100644
index 69d3515d..00000000
--- a/src-qt5/src-glwidgets/glw-widget.h
+++ /dev/null
@@ -1,63 +0,0 @@
-//===========================================
-// 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_OPENGL_WIDGETS_WIDGET_H
-#define _LUMINA_OPENGL_WIDGETS_WIDGET_H
-
-#include <QWidget>
-#include <QPaintEvent>
-#include <QStylePainter>
-#include <QResizeEvent>
-#include <QStylePainter>
-
-#include "glw-base.h"
-
-class GLW_Widget : public QWidget{
- Q_OBJECT
-private:
- GLW_Base *glw_base;
- QPoint drag_offset;
- bool draggable;
-
-public:
- GLW_Widget(QWidget *parent = Q_NULLPTR, Qt::WindowFlags f = Qt::WindowFlags());
- ~GLW_Widget();
-
- QRect widgetRect(); //converts to the coordinate scheme of the base widget
- bool mouseOverWidget();
-
- void setGLBase(GLW_Base *base);
-
- virtual void paintYourself(QStylePainter *painter, const QRect *prect);
- void paintChildren(QStylePainter *painter, const QRect *prect);
-
- //Properties
- bool isDraggable(){ return draggable; }
-
-private slots:
-
-public slots:
- void setDraggable(bool drag){ draggable = drag; }
-
-
-protected:
- virtual void enterEvent(QEvent*);
- virtual void leaveEvent(QEvent*);
-
- virtual void mousePressEvent(QMouseEvent *ev);
- virtual void mouseReleaseEvent(QMouseEvent *ev);
- virtual void mouseMoveEvent(QMouseEvent *ev);
- virtual void moveEvent(QMoveEvent *ev);
- virtual void resizeEvent(QResizeEvent *ev);
- virtual void paintEvent(QPaintEvent *ev);
-
-signals:
- void repaintArea(QRect);
- void doneDragging();
-};
-
-Q_DECLARE_INTERFACE(GLW_Widget, "GLW_Widget");
-#endif
diff --git a/src-qt5/src-glwidgets/glwidgets.pri b/src-qt5/src-glwidgets/glwidgets.pri
deleted file mode 100644
index e391aef0..00000000
--- a/src-qt5/src-glwidgets/glwidgets.pri
+++ /dev/null
@@ -1,7 +0,0 @@
-QT *= widgets
-
-SOURCES *= $${PWD}/glw-base.cpp \
- $${PWD}/glw-widget.cpp
-
-HEADERS *= $${PWD}/glw-base.h \
- $${PWD}/glw-widget.h
bgstack15