src/platform/qt/DisplayQt.h (view raw)
1/* Copyright (c) 2013-2015 Jeffrey Pfau
2 *
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6#pragma once
7
8#include "Display.h"
9
10#include <QImage>
11#include <QTimer>
12
13namespace QGBA {
14
15class DisplayQt : public Display {
16Q_OBJECT
17
18public:
19 DisplayQt(QWidget* parent = nullptr);
20
21 void startDrawing(std::shared_ptr<CoreController>) override;
22 bool isDrawing() const override { return m_isDrawing; }
23 bool supportsShaders() const override { return false; }
24 VideoShader* shaders() override { return nullptr; }
25
26public slots:
27 void stopDrawing() override;
28 void pauseDrawing() override { m_isDrawing = false; }
29 void unpauseDrawing() override { m_isDrawing = true; }
30 void forceDraw() override { update(); }
31 void lockAspectRatio(bool lock) override;
32 void lockIntegerScaling(bool lock) override;
33 void filter(bool filter) override;
34 void framePosted() override;
35 void setShaders(struct VDir*) override {}
36 void clearShaders() override {}
37 void resizeContext() override;
38
39protected:
40 virtual void paintEvent(QPaintEvent*) override;
41
42private:
43 bool m_isDrawing = false;
44 unsigned m_width;
45 unsigned m_height;
46 QImage m_backing{nullptr};
47 std::shared_ptr<CoreController> m_context = nullptr;
48};
49
50}