1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
|
/***************************************************************************
* *
* This file is part of the Fotowall project, *
* http://www.enricoros.com/opensource/fotowall *
* *
* Copyright (C) 2009 by Enrico Ros <enrico.ros@gmail.com> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef __Hardware3DTest_h__
#define __Hardware3DTest_h__
#include <QDialog>
#include <QTime>
#include "SceneView.h"
class Canvas;
class TimedSceneView;
class PictureContent;
class Hardware3DTest : public QDialog
{
Q_OBJECT
public:
Hardware3DTest(QWidget * parent = 0, Qt::WindowFlags f = 0);
// run the software & hardware render tests
enum ExitState { Canceled, UseSoftware, UseOpenGL };
ExitState run();
Q_SIGNALS:
void testStarted();
void testEnded(bool openglWins);
private:
Canvas * m_canvas;
TimedSceneView * m_view;
QVector<PictureContent *> m_pictures;
QVector<int> m_results;
int m_resultIdx;
ExitState m_retCode;
// state variables (TODO 1.0: replace with QStateMachine)
enum State { Off, TestingSoftware, TestingOpenGL, Finished };
State m_state;
int m_statePhase; // 0 .. TESTPOWER
private Q_SLOTS:
void showResults();
void nextStep();
void slotViewRepainted(int durationMs);
void slotUseSoftware();
void slotUseOpenGL();
};
class TimedSceneView : public SceneView
{
Q_OBJECT
public:
TimedSceneView(QWidget * parent = 0);
// start a measure, will emit 'repainted' upon completion
void measureNextRepaint();
// flush updats
void flushPaints();
Q_SIGNALS:
void repainted(int durationMs);
protected:
// ::QWidget
void paintEvent(QPaintEvent * event);
private:
bool m_measureRepaint;
};
#endif
|