Commit 0154a866 authored by Utkarsh Ayachit's avatar Utkarsh Ayachit

Organize ParaQ source tree like ParaView

Update CMake scripts to work with the restructured repository.

A new CVS repository was created on 2006-03-22 to re-organize the
ParaQ source tree into a layout similar to that of ParaView 2.x and
drop the Tcl/Tk GUI.  This was in preparation for the final transition
to the Qt-based GUI as the official ParaView 3.0 GUI.  This commit was
manufactured during conversion from CVS to represent the layout change
as part of the first commit to the new repository.
parent 88e00bc7
CMAKE_MINIMUM_REQUIRED(VERSION 2.2)
PROJECT(QtTesting)
FIND_PACKAGE(Qt4)
SET(QT_USE_QTXML TRUE)
INCLUDE(${QT_USE_FILE})
INCLUDE_DIRECTORIES(
${QtTesting_BINARY_DIR}
${QtTesting_SOURCE_DIR}
${ParaQ_SOURCE_DIR}/ParaView/VTK/Imaging
)
QT4_WRAP_CPP(MOC_BUILT_SOURCES
pqAbstractButtonEventTranslator.h
pqAbstractSliderEventTranslator.h
pqComboBoxEventTranslator.h
pqDoubleSpinBoxEventTranslator.h
pqEventObserverStdout.h
pqEventObserverXML.h
pqEventTranslator.h
pqLineEditEventTranslator.h
pqMenuEventTranslator.h
pqMenuEventTranslatorAdaptor.h
pqRecordEventsDialog.h
pqSpinBoxEventTranslator.h
pqWidgetEventTranslator.h
)
QT4_WRAP_UI(UI_BUILT_SOURCES
pqRecordEventsDialog.ui
)
ADD_LIBRARY(QtTesting
pqAbstractActivateEventPlayer.cxx
pqAbstractActivateEventPlayer.h
pqAbstractBooleanEventPlayer.cxx
pqAbstractBooleanEventPlayer.h
pqAbstractButtonEventTranslator.cxx
pqAbstractButtonEventTranslator.h
pqAbstractDoubleEventPlayer.cxx
pqAbstractDoubleEventPlayer.h
pqAbstractIntEventPlayer.cxx
pqAbstractIntEventPlayer.h
pqAbstractSliderEventTranslator.cxx
pqAbstractSliderEventTranslator.h
pqAbstractStringEventPlayer.cxx
pqAbstractStringEventPlayer.h
pqComboBoxEventTranslator.cxx
pqComboBoxEventTranslator.h
pqDoubleSpinBoxEventTranslator.cxx
pqDoubleSpinBoxEventTranslator.h
pqEventObserverStdout.cxx
pqEventObserverStdout.h
pqEventObserverXML.cxx
pqEventObserverXML.h
pqEventPlayer.cxx
pqEventPlayer.h
pqEventPlayerXML.cxx
pqEventPlayerXML.h
pqEventTranslator.cxx
pqEventTranslator.h
pqImageComparison.cxx
pqImageComparison.h
pqLineEditEventTranslator.cxx
pqLineEditEventTranslator.h
pqMenuEventTranslator.cxx
pqMenuEventTranslator.h
pqMenuEventTranslatorAdaptor.cxx
pqMenuEventTranslatorAdaptor.h
pqRecordEventsDialog.cxx
pqRecordEventsDialog.h
pqSpinBoxEventTranslator.cxx
pqSpinBoxEventTranslator.h
pqWidgetEventPlayer.h
pqWidgetEventTranslator.h
QtTestingExport.h
${MOC_BUILT_SOURCES}
${UI_BUILT_SOURCES}
)
SOURCE_GROUP("Generated" FILES
${MOC_BUILT_SOURCES}
${UI_BUILT_SOURCES}
)
TARGET_LINK_LIBRARIES(QtTesting
vtkIO
vtkRendering
${QT_LIBRARIES}
${QT_XML_LIBRARIES}
)
/*
* Copyright 2004 Sandia Corporation.
* Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive
* license for use of this work by or on behalf of the
* U.S. Government. Redistribution and use in source and binary forms, with
* or without modification, are permitted provided that this Notice and any
* statement of authorship are reproduced on all copies.
*/
#ifndef _QtTestingExport_h
#define _QtTestingExport_h
#if defined(WIN32) && defined(PARAQ_BUILD_SHARED_LIBS)
# if defined(QtTesting_EXPORTS)
# define QTTESTING_EXPORT __declspec(dllexport)
# else
# define QTTESTING_EXPORT __declspec(dllimport)
# endif
#else
# define QTTESTING_EXPORT
#endif
#endif // !_QtTestingExport_h
/*
* Copyright 2004 Sandia Corporation.
* Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive
* license for use of this work by or on behalf of the
* U.S. Government. Redistribution and use in source and binary forms, with
* or without modification, are permitted provided that this Notice and any
* statement of authorship are reproduced on all copies.
*/
#include "pqAbstractActivateEventPlayer.h"
#include <QAction>
#include <QPushButton>
#include <QtDebug>
pqAbstractActivateEventPlayer::pqAbstractActivateEventPlayer()
{
}
bool pqAbstractActivateEventPlayer::playEvent(QObject* Object, const QString& Command, const QString& /*Arguments*/, bool& Error)
{
if(Command != "activate")
return false;
if(QAction* const object = qobject_cast<QAction*>(Object))
{
object->activate(QAction::Trigger);
return true;
}
if(QAbstractButton* const object = qobject_cast<QAbstractButton*>(Object))
{
object->click();
return true;
}
qCritical() << "calling activate on unhandled type " << Object;
Error = true;
return true;
}
/*
* Copyright 2004 Sandia Corporation.
* Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive
* license for use of this work by or on behalf of the
* U.S. Government. Redistribution and use in source and binary forms, with
* or without modification, are permitted provided that this Notice and any
* statement of authorship are reproduced on all copies.
*/
#ifndef _pqAbstractActivateEventPlayer_h
#define _pqAbstractActivateEventPlayer_h
#include "pqWidgetEventPlayer.h"
/// Translates high-level ParaQ events into low-level Qt action events
class pqAbstractActivateEventPlayer :
public pqWidgetEventPlayer
{
public:
pqAbstractActivateEventPlayer();
bool playEvent(QObject* Object, const QString& Command, const QString& Arguments, bool& Error);
private:
pqAbstractActivateEventPlayer(const pqAbstractActivateEventPlayer&);
pqAbstractActivateEventPlayer& operator=(const pqAbstractActivateEventPlayer&);
};
#endif // !_pqAbstractActivateEventPlayer_h
/*
* Copyright 2004 Sandia Corporation.
* Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive
* license for use of this work by or on behalf of the
* U.S. Government. Redistribution and use in source and binary forms, with
* or without modification, are permitted provided that this Notice and any
* statement of authorship are reproduced on all copies.
*/
#include "pqAbstractBooleanEventPlayer.h"
#include <QAbstractButton>
#include <QtDebug>
pqAbstractBooleanEventPlayer::pqAbstractBooleanEventPlayer()
{
}
bool pqAbstractBooleanEventPlayer::playEvent(QObject* Object, const QString& Command, const QString& Arguments, bool& Error)
{
if(Command != "set_boolean")
return false;
const bool value = Arguments == "true" ? true : false;
if(QAbstractButton* const object = qobject_cast<QAbstractButton*>(Object))
{
if(value != object->isChecked())
object->setChecked(value);
return true;
}
qCritical() << "calling set_boolean on unhandled type " << Object;
Error = true;
return true;
}
/*
* Copyright 2004 Sandia Corporation.
* Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive
* license for use of this work by or on behalf of the
* U.S. Government. Redistribution and use in source and binary forms, with
* or without modification, are permitted provided that this Notice and any
* statement of authorship are reproduced on all copies.
*/
#ifndef _pqAbstractBooleanEventPlayer_h
#define _pqAbstractBooleanEventPlayer_h
#include "pqWidgetEventPlayer.h"
/// Translates high-level ParaQ events into low-level Qt action events
class pqAbstractBooleanEventPlayer :
public pqWidgetEventPlayer
{
public:
pqAbstractBooleanEventPlayer();
bool playEvent(QObject* Object, const QString& Command, const QString& Arguments, bool& Error);
private:
pqAbstractBooleanEventPlayer(const pqAbstractBooleanEventPlayer&);
pqAbstractBooleanEventPlayer& operator=(const pqAbstractBooleanEventPlayer&);
};
#endif // !_pqAbstractBooleanEventPlayer_h
/*
* Copyright 2004 Sandia Corporation.
* Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive
* license for use of this work by or on behalf of the
* U.S. Government. Redistribution and use in source and binary forms, with
* or without modification, are permitted provided that this Notice and any
* statement of authorship are reproduced on all copies.
*/
#include "pqAbstractButtonEventTranslator.h"
#include <QAbstractButton>
#include <QToolButton>
#include <QAction>
#include <QEvent>
pqAbstractButtonEventTranslator::pqAbstractButtonEventTranslator() :
CurrentObject(0)
{
}
bool pqAbstractButtonEventTranslator::translateEvent(QObject* Object, QEvent* Event, bool& /*Error*/)
{
QAbstractButton* const object = qobject_cast<QAbstractButton*>(Object);
if(!object)
return false;
switch(Event->type())
{
case QEvent::Enter:
this->CurrentObject = Object;
if(object->isCheckable())
connect(object, SIGNAL(clicked(bool)), this, SLOT(onToggled(bool)));
else
connect(object, SIGNAL(clicked(bool)), this, SLOT(onClicked(bool)));
break;
case QEvent::Leave:
disconnect(Object, 0, this, 0);
this->CurrentObject = 0;
break;
default:
break;
}
return true;
}
void pqAbstractButtonEventTranslator::onClicked(bool)
{
if(this->CurrentObject->objectName() == QString::null && qobject_cast<QToolButton*>(this->CurrentObject))
{
emit recordEvent(qobject_cast<QToolButton*>(this->CurrentObject)->defaultAction(), "activate", "");
}
else
{
emit recordEvent(this->CurrentObject, "activate", "");
}
}
void pqAbstractButtonEventTranslator::onToggled(bool Checked)
{
emit recordEvent(this->CurrentObject, "set_boolean", Checked ? "true" : "false");
}
/*
* Copyright 2004 Sandia Corporation.
* Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive
* license for use of this work by or on behalf of the
* U.S. Government. Redistribution and use in source and binary forms, with
* or without modification, are permitted provided that this Notice and any
* statement of authorship are reproduced on all copies.
*/
#ifndef _pqAbstractButtonEventTranslator_h
#define _pqAbstractButtonEventTranslator_h
#include "pqWidgetEventTranslator.h"
/// Translates low-level Qt push button events into high-level ParaQ events that can be recorded as test cases
class pqAbstractButtonEventTranslator :
public pqWidgetEventTranslator
{
Q_OBJECT
public:
pqAbstractButtonEventTranslator();
virtual bool translateEvent(QObject* Object, QEvent* Event, bool& Error);
private:
pqAbstractButtonEventTranslator(const pqAbstractButtonEventTranslator&);
pqAbstractButtonEventTranslator& operator=(const pqAbstractButtonEventTranslator&);
QObject* CurrentObject;
private slots:
void onClicked(bool);
void onToggled(bool);
};
#endif // !_pqAbstractButtonEventTranslator_h
/*
* Copyright 2004 Sandia Corporation.
* Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive
* license for use of this work by or on behalf of the
* U.S. Government. Redistribution and use in source and binary forms, with
* or without modification, are permitted provided that this Notice and any
* statement of authorship are reproduced on all copies.
*/
#include "pqAbstractDoubleEventPlayer.h"
#include <QDoubleSpinBox>
#include <QtDebug>
pqAbstractDoubleEventPlayer::pqAbstractDoubleEventPlayer()
{
}
bool pqAbstractDoubleEventPlayer::playEvent(QObject* Object, const QString& Command, const QString& Arguments, bool& Error)
{
if(Command != "set_double")
return false;
const double value = Arguments.toDouble();
if(QDoubleSpinBox* const object = qobject_cast<QDoubleSpinBox*>(Object))
{
object->setValue(value);
return true;
}
qCritical() << "calling set_double on unhandled type " << Object;
Error = true;
return true;
}
/*
* Copyright 2004 Sandia Corporation.
* Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive
* license for use of this work by or on behalf of the
* U.S. Government. Redistribution and use in source and binary forms, with
* or without modification, are permitted provided that this Notice and any
* statement of authorship are reproduced on all copies.
*/
#ifndef _pqAbstractDoubleEventPlayer_h
#define _pqAbstractDoubleEventPlayer_h
#include "pqWidgetEventPlayer.h"
/// Translates high-level ParaQ events into low-level Qt slider events
class pqAbstractDoubleEventPlayer :
public pqWidgetEventPlayer
{
public:
pqAbstractDoubleEventPlayer();
bool playEvent(QObject* Object, const QString& Command, const QString& Arguments, bool& Error);
private:
pqAbstractDoubleEventPlayer(const pqAbstractDoubleEventPlayer&);
pqAbstractDoubleEventPlayer& operator=(const pqAbstractDoubleEventPlayer&);
};
#endif // !_pqAbstractDoubleEventPlayer_h
/*
* Copyright 2004 Sandia Corporation.
* Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive
* license for use of this work by or on behalf of the
* U.S. Government. Redistribution and use in source and binary forms, with
* or without modification, are permitted provided that this Notice and any
* statement of authorship are reproduced on all copies.
*/
#include "pqAbstractIntEventPlayer.h"
#include <QAbstractSlider>
#include <QSpinBox>
#include <QtDebug>
pqAbstractIntEventPlayer::pqAbstractIntEventPlayer()
{
}
bool pqAbstractIntEventPlayer::playEvent(QObject* Object, const QString& Command, const QString& Arguments, bool& Error)
{
if(Command != "set_int")
return false;
const int value = Arguments.toInt();
if(QAbstractSlider* const object = qobject_cast<QAbstractSlider*>(Object))
{
object->setValue(value);
return true;
}
if(QSpinBox* const object = qobject_cast<QSpinBox*>(Object))
{
object->setValue(value);
return true;
}
qCritical() << "calling set_int on unhandled type " << Object;
Error = true;
return true;
}
/*
* Copyright 2004 Sandia Corporation.
* Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive
* license for use of this work by or on behalf of the
* U.S. Government. Redistribution and use in source and binary forms, with
* or without modification, are permitted provided that this Notice and any
* statement of authorship are reproduced on all copies.
*/
#ifndef _pqAbstractIntEventPlayer_h
#define _pqAbstractIntEventPlayer_h
#include "pqWidgetEventPlayer.h"
/// Translates high-level ParaQ events into low-level Qt slider events
class pqAbstractIntEventPlayer :
public pqWidgetEventPlayer
{
public:
pqAbstractIntEventPlayer();
bool playEvent(QObject* Object, const QString& Command, const QString& Arguments, bool& Error);
private:
pqAbstractIntEventPlayer(const pqAbstractIntEventPlayer&);
pqAbstractIntEventPlayer& operator=(const pqAbstractIntEventPlayer&);
};
#endif // !_pqAbstractIntEventPlayer_h
/*
* Copyright 2004 Sandia Corporation.
* Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive
* license for use of this work by or on behalf of the
* U.S. Government. Redistribution and use in source and binary forms, with
* or without modification, are permitted provided that this Notice and any
* statement of authorship are reproduced on all copies.
*/
#include "pqAbstractSliderEventTranslator.h"
#include <QAbstractSlider>
#include <QEvent>
pqAbstractSliderEventTranslator::pqAbstractSliderEventTranslator() :
CurrentObject(0)
{
}
bool pqAbstractSliderEventTranslator::translateEvent(QObject* Object, QEvent* Event, bool& /*Error*/)
{
QAbstractSlider* const object = qobject_cast<QAbstractSlider*>(Object);
if(!object)
return false;
switch(Event->type())
{
case QEvent::Enter:
this->CurrentObject = Object;
connect(object, SIGNAL(valueChanged(int)), this, SLOT(onValueChanged(int)));
break;
case QEvent::Leave:
disconnect(Object, 0, this, 0);
this->CurrentObject = 0;
break;
default:
break;
}
return true;
}
void pqAbstractSliderEventTranslator::onValueChanged(int Value)
{
emit recordEvent(this->CurrentObject, "set_int", QString().setNum(Value));
}
/*
* Copyright 2004 Sandia Corporation.
* Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive
* license for use of this work by or on behalf of the
* U.S. Government. Redistribution and use in source and binary forms, with
* or without modification, are permitted provided that this Notice and any
* statement of authorship are reproduced on all copies.
*/
#ifndef _pqAbstractSliderEventTranslator_h
#define _pqAbstractSliderEventTranslator_h
#include "pqWidgetEventTranslator.h"
/// Translates low-level Qt slider events into high-level ParaQ events that can be recorded as test cases
class pqAbstractSliderEventTranslator :
public pqWidgetEventTranslator
{
Q_OBJECT
public:
pqAbstractSliderEventTranslator();
virtual bool translateEvent(QObject* Object, QEvent* Event, bool& Error);
private:
pqAbstractSliderEventTranslator(const pqAbstractSliderEventTranslator&);
pqAbstractSliderEventTranslator& operator=(const pqAbstractSliderEventTranslator&);
QObject* CurrentObject;
private slots:
void onValueChanged(int);
};
#endif // !_pqAbstractSliderEventTranslator_h
/*
* Copyright 2004 Sandia Corporation.
* Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive
* license for use of this work by or on behalf of the
* U.S. Government. Redistribution and use in source and binary forms, with
* or without modification, are permitted provided that this Notice and any
* statement of authorship are reproduced on all copies.
*/
#include "pqAbstractStringEventPlayer.h"
#include <QComboBox>
#include <QLineEdit>
#include <QtDebug>
pqAbstractStringEventPlayer::pqAbstractStringEventPlayer()
{
}
bool pqAbstractStringEventPlayer::playEvent(QObject* Object, const QString& Command, const QString& Arguments, bool& Error)
{
if(Command != "set_string")
return false;
const QString value = Arguments;
if(QComboBox* const object = qobject_cast<QComboBox*>(Object))
{
object->setEditText(value);
return true;
}
if(QLineEdit* const object = qobject_cast<QLineEdit*>(Object))
{
object->setText(value);
return true;
}
qCritical() << "calling set_string on unhandled type " << Object;
Error = true;
return true;
}
/*
* Copyright 2004 Sandia Corporation.
* Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive
* license for use of this work by or on behalf of the
* U.S. Government. Redistribution and use in source and binary forms, with
* or without modification, are permitted provided that this Notice and any
* statement of authorship are reproduced on all copies.
*/
#ifndef _pqAbstractStringEventPlayer_h
#define _pqAbstractStringEventPlayer_h
#include "pqWidgetEventPlayer.h"
/// Translates high-level ParaQ events into low-level Qt slider events
class pqAbstractStringEventPlayer :
public pqWidgetEventPlayer
{
public:
pqAbstractStringEventPlayer();
bool playEvent(QObject* Object, const QString& Command, const QString& Arguments, bool& Error);
private:
pqAbstractStringEventPlayer(const pqAbstractStringEventPlayer&);
pqAbstractStringEventPlayer& operator=(const pqAbstractStringEventPlayer&);
};
#endif // !_pqAbstractStringEventPlayer_h
/*
* Copyright 2004 Sandia Corporation.
* Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive
* license for use of this work by or on behalf of the
* U.S. Government. Redistribution and use in source and binary forms, with
* or without modification, are permitted provided that this Notice and any
* statement of authorship are reproduced on all copies.
*/
#include "pqComboBoxEventTranslator.h"
#include <QComboBox>
#include <QEvent>
pqComboBoxEventTranslator::pqComboBoxEventTranslator() :
CurrentObject(0)
{
}
bool pqComboBoxEventTranslator::translateEvent(QObject* Object, QEvent* Event, bool& /*Error*/)
{
QComboBox* const object = qobject_cast<QComboBox*>(Object);
if(!object)
return false;
switch(Event->type())
{
case QEvent::Enter:
if(this->CurrentObject != Object)
{
if(this->CurrentObject)
{
disconnect(this->CurrentObject, 0, this, 0);
}
this->CurrentObject = Object;
connect(object, SIGNAL(destroyed(QObject*)), this, SLOT(onDestroyed(QObject*)));
connect(object, SIGNAL(activated(const QString&)), this, SLOT(onStateChanged(const QString&)));
connect(object, SIGNAL(editTextChanged(const QString&)), this, SLOT(onStateChanged(const QString&)));
}
break;
default:
break;
}
return true;
}
void pqComboBoxEventTranslator::onDestroyed(QObject* /*Object*/)
{
this->CurrentObject = 0;
}
void pqComboBoxEventTranslator::onStateChanged(const QString& State)
{
emit recordEvent(this->CurrentObject, "set_string", State);
}