Commit 03041535 authored by Jakob Weiss's avatar Jakob Weiss
Browse files

Fullscreen and Thread Names on Windows

* Debug Feature: Thread names for pipelines and some important active threads show in debugger
* fullscreen can be toggled per pipeline via the pipeline property and via ALT+Return key combination
parent 69d7ea4d
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@
#include "core/pipeline/abstractworkflow.h"
#include "core/pipeline/pipelinefactory.h"
#include "core/pipeline/pipelinepainter.h"
#include "core/pipeline/visualizationprocessor.h"
#include "core/datastructures/imagerepresentationconverter.h"
#include "core/pipeline/visualizationprocessor.h"

@@ -275,6 +276,7 @@ namespace campvis {
#endif

        GLCtxtMgr.releaseContext(canvas, false);

        s_PipelinesChanged.emitSignal();

        startOpenGlThreadAndMoveQtThreadAffinity(pipeline, canvas);
+37 −0
Original line number Diff line number Diff line
@@ -26,6 +26,9 @@
#include "mdidockarea.h"

#include <QAction>
#include <QLayout>
#include <QMainWindow>
#include <cgt/qt/qtcanvas.h>

namespace campvis {

@@ -36,6 +39,8 @@ namespace campvis {
        , _dockedWindow(0)
        , _floatingWindow(0)
        , _toggleViewAction(0)
        , _widget(widget)
        , _fullScreenWidget(0)
    {
        this->setWindowFlags(windowFlags);
        _dockedWindow = this->newDockedWindow(widget);
@@ -44,6 +49,11 @@ namespace campvis {
        _toggleViewAction->setCheckable(true);
        _toggleViewAction->setChecked(false);
        this->connect(_toggleViewAction, SIGNAL(toggled(bool)), SLOT(toggleWindowVisibility(bool)));

        if (dynamic_cast<cgt::QtCanvas*>(widget)) {
            connect(widget, SIGNAL(fullScreenChanged(bool)), this, SLOT(handleFullScreenChanged(bool)));
        }

    }

    void MdiDockableWindow::setWindowTitle(const QString& title) {
@@ -163,5 +173,32 @@ namespace campvis {
                          SLOT(trackFloatingWindowPosition(const QPoint&)));
        }
    }
    void MdiDockableWindow::handleFullScreenChanged(bool fullscreen) {
        if (_docked && _dockedWindow) {
            if (fullscreen) {
                _fullScreenWidget = new QMainWindow();
                _fullScreenWidget->setCentralWidget(_widget);
                _fullScreenWidget->showFullScreen();
            }
            else {
                if (_dockedWindow->layout()) {
                    _dockedWindow->layout()->addWidget(_widget);
                }
                else {
                    setParent(_dockedWindow);
                }
                delete _fullScreenWidget;
                _fullScreenWidget = nullptr;
            }
        }

        if (!_docked && _floatingWindow) {
            if (fullscreen)
                _floatingWindow->showFullScreen();
            else
                _floatingWindow->showNormal();
        }

    }

}
+9 −1
Original line number Diff line number Diff line
@@ -31,6 +31,8 @@
#include "application/gui/qtcolortools.h"
#include <QWidget>

class QMainWindow;

namespace campvis {

    class MdiDockArea;
@@ -111,6 +113,11 @@ namespace campvis {
         */
        void handleWindowClosing();

        /**
         * Handle changing fullscreen state requested by the QtCanvas widget
         */
        void handleFullScreenChanged(bool fullscreen);

    private:
        /**
         * Create and return an MdiDockedWindow wrapping the \p widget.
@@ -124,7 +131,8 @@ namespace campvis {
        MdiDockedWindow* _dockedWindow;       ///< The window's docked representation.
        MdiFloatingWindow* _floatingWindow;   ///< The window's floating representation.
        QAction* _toggleViewAction;           ///< A checkable action that can be used to show or hide this window.

        QWidget* _widget;                     ///< Widget that was wrapped
        QMainWindow* _fullScreenWidget;       ///< Container widget used to display docked canvas in fullscreen
    };
}

+13 −0
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@ namespace campvis {
        , _canvasSize("CanvasSize", "Canvas Size", cgt::ivec2(128, 128), cgt::ivec2(1, 1), cgt::ivec2(4096, 4096))
        , _ignoreCanvasSizeUpdate(false)
        , _renderTargetID("renderTargetID", "Render Target ID", "AbstractPipeline.renderTarget", DataNameProperty::READ)
        , p_showFullscreen("ShowFullscreen", "Show Fullscreen", false)
    {
        cgtAssert(_dataContainer != nullptr, "Pointer to the DataContainer for this pipeline must not be 0!");

@@ -59,12 +60,15 @@ namespace campvis {

        addProperty(_renderTargetID);
        addProperty(_canvasSize);
        addProperty(p_showFullscreen);
    }

    AbstractPipeline::~AbstractPipeline() {
    }

    void AbstractPipeline::init() {
        setThreadName(std::string("Pipeline ") + getName());

        _dataContainer->s_dataAdded.connect(this, &AbstractPipeline::onDataContainerDataAdded);

        _painter->init();
@@ -80,6 +84,8 @@ namespace campvis {
            }
        }

        p_showFullscreen.s_changed.connect(this, &AbstractPipeline::onFullscreenChanged);

        // use trigger signal to enforce blocking call
        s_init.triggerSignal();
    }
@@ -148,6 +154,13 @@ namespace campvis {
        }
    }

    void AbstractPipeline::onFullscreenChanged(const AbstractProperty * prop)
    {
        if (_canvas) {
            _canvas->toggleFullScreen();
        }
    }

    void AbstractPipeline::paint() {
        // render nothing. May be overridden in sub classes.
    }
+9 −1
Original line number Diff line number Diff line
@@ -215,6 +215,9 @@ namespace campvis {
         */
        IVec2Property& getCanvasSize() { return _canvasSize; }

        /** Property indicating whether this pipeline should display fullscreen */
        BoolProperty p_showFullscreen;

        /**
         * Returns this pipelines PipelinePainter.
         * \return  _painter
@@ -256,11 +259,16 @@ namespace campvis {

        /**
         * Slot getting called when one of the observed properties changed and notifies its observers.
         * The default behaviour is just to set the invalidation level to invalid.
         * The default behavior is just to set the invalidation level to invalid.
         * \param   prop    Property that emitted the signal
         */
        virtual void onPropertyChanged(const AbstractProperty* prop);

        /**
         * Slot getting called when p_showFullscreen changes. Triggers a switch between fullscreen and non-fullscreen mode
         * \param fullscreen    Flag indicating whether the pipeline should display fullscreen
         */
        virtual void onFullscreenChanged(const AbstractProperty * prop);

        /// Pointer to the DataContainer containing local working set of data for this Pipeline, must not be 0.
        DataContainer* _dataContainer;
Loading