Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorr.kuznetsov <r.kuznetsov@corp.mail.ru>2015-09-22 12:10:28 +0300
committerr.kuznetsov <r.kuznetsov@corp.mail.ru>2015-11-30 16:14:15 +0300
commit8258b9d3bca807ae57ad5d2353a18f7ea61e91b2 (patch)
tree64942106289174db64b9a5d09a7aa158ba2c727f /qt_tstfrm
parent5d64595ff39eb8eac76b0b1c54ba4678612c1124 (diff)
Removed obsolete stuff and warning fix
Diffstat (limited to 'qt_tstfrm')
-rw-r--r--qt_tstfrm/gl_test_widget.hpp217
-rw-r--r--qt_tstfrm/gui_test_widget.hpp157
-rw-r--r--qt_tstfrm/macros.hpp3
-rw-r--r--qt_tstfrm/tstwidgets.cpp146
-rw-r--r--qt_tstfrm/tstwidgets.hpp45
5 files changed, 0 insertions, 568 deletions
diff --git a/qt_tstfrm/gl_test_widget.hpp b/qt_tstfrm/gl_test_widget.hpp
deleted file mode 100644
index 459ce880ee..0000000000
--- a/qt_tstfrm/gl_test_widget.hpp
+++ /dev/null
@@ -1,217 +0,0 @@
-#pragma once
-
-#include "tstwidgets.hpp"
-
-#include "testing/testing.hpp"
-
-#include "map/qgl_render_context.hpp"
-
-#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
- #include <QtGui/QApplication>
-#else
- #include <QtWidgets/QApplication>
-#endif
-
-template<class T, bool (T::*)(QKeyEvent *)>
-struct key_event_fn_bind
-{
- typedef T type;
-};
-
-template <class T, bool (T::*)(QMouseEvent*)>
-struct mouse_event_fn_bind
-{
- typedef T type;
-};
-
-template <class T, void (T::*)()>
-struct void_fn_bind
-{
- typedef T type;
-};
-
-template <class T, class RC, void (T::*)(shared_ptr<RC>)>
-struct init_with_context_fn_bind
-{
- typedef T type;
-};
-
-template<class T, class U>
-struct has_on_keypress
-{
- static const bool value = false;
-};
-
-template<class T>
-struct has_on_keypress<T, typename key_event_fn_bind<T, &T::OnKeyPress>::type>
-{
- static const bool value = true;
-};
-
-template <class T, class U>
-struct has_on_mousemove
-{
- static const bool value = false;
-};
-
-template <class T>
-struct has_on_mousemove<T, typename mouse_event_fn_bind<T, &T::OnMouseMove>::type >
-{
- static const bool value = true;
-};
-
-template <class T, class U>
-struct has_on_mousepress
-{
- static bool const value = false;
-};
-
-template <class T>
-struct has_on_mousepress<T, typename mouse_event_fn_bind<T, &T::OnMousePress>::type >
-{
- static const bool value = true;
-};
-
-template <class T, class U>
-struct has_init
-{
- static bool const value = false;
-};
-
-template <class T>
-struct has_init<T, typename void_fn_bind<T, &T::Init>::type >
-{
- static const bool value = true;
-};
-
-template <class T, class U, class RC>
-struct has_init_with_context
-{
- static bool const value = false;
-};
-
-template <class T, class RC>
-struct has_init_with_context<T, typename init_with_context_fn_bind<T, RC, &T::Init>::type, RC >
-{
- static const bool value = true;
-};
-
-template <bool T>
-struct bool_tag{};
-
-template <typename TTest>
-class GLTestWidget : public tst::GLDrawWidget
-{
-public:
-
- TTest test;
-
- typedef tst::GLDrawWidget base_type;
-
- virtual void DoDraw(shared_ptr<graphics::Screen> const & p)
- {
- p->beginFrame();
- p->clear(graphics::Color(182, 182, 182, 255));
- test.DoDraw(p);
- p->endFrame();
- }
-
- virtual void DoResize(int, int)
- {
- }
-
- bool keyPressEventImpl(QKeyEvent * ev, bool_tag<true> const &)
- {
- return test.OnKeyPress(ev);
- }
-
- bool keyPressEventImpl(QKeyEvent *, bool_tag<false> const & )
- {
- return false;
- }
-
- virtual void keyPressEvent(QKeyEvent * ev)
- {
- if (keyPressEventImpl(ev, bool_tag<has_on_keypress<TTest, TTest>::value >()))
- repaint();
- }
-
- bool mousePressEventImpl(QMouseEvent * ev, bool_tag<true> const &)
- {
- return test.OnMousePress(ev);
- }
-
- bool mousePressEventImpl(QMouseEvent *, bool_tag<false> const &)
- {
- return false;
- }
-
- virtual void mousePressEvent(QMouseEvent * ev)
- {
- if (mousePressEventImpl(ev, bool_tag<has_on_mousepress<TTest, TTest>::value >()))
- repaint();
- }
-
- bool mouseMoveEventImpl(QMouseEvent * ev, bool_tag<true> const &)
- {
- return test.OnMouseMove(ev);
- }
-
- bool mouseMoveEventImpl(QMouseEvent *, bool_tag<false> const &)
- {
- return false;
- }
-
- void mouseMoveEvent(QMouseEvent * ev)
- {
- if (mouseMoveEventImpl(ev, bool_tag<has_on_mousemove<TTest, TTest>::value >()))
- repaint();
- }
-
- void InitImpl(bool_tag<true> const & )
- {
- test.Init();
- }
-
- void InitImpl(bool_tag<false> const & )
- {}
-
- void Init()
- {
- InitImpl(bool_tag<has_init<TTest, TTest>::value >());
- }
-
- void InitWithContextImpl(bool_tag<true> const &)
- {
- test.Init(shared_ptr<qt::gl::RenderContext>(new qt::gl::RenderContext(this)));
- }
-
- void InitWithContextImpl(bool_tag<false> const &)
- {}
-
- void initializeGL()
- {
- tst::GLDrawWidget::initializeGL();
- InitWithContextImpl(bool_tag<has_init_with_context<TTest, TTest, qt::gl::RenderContext>::value>());
- }
-};
-
-template <class Test> QWidget * create_widget()
-{
- GLTestWidget<Test> * w = new GLTestWidget<Test>();
- w->Init();
- return w;
-}
-
-#define UNIT_TEST_GL(name)\
- void UnitTestGL_##name();\
- TestRegister g_TestRegister_##name("Test::"#name, __FILE__, &UnitTestGL_##name);\
- void UnitTestGL_##name()\
- {\
- char * argv[] = { const_cast<char *>(#name) };\
- int argc = 1;\
- QApplication app(argc, argv);\
- QWidget * w = create_widget<name>();\
- w->show();\
- app.exec();\
- }
diff --git a/qt_tstfrm/gui_test_widget.hpp b/qt_tstfrm/gui_test_widget.hpp
deleted file mode 100644
index 6596c8a91d..0000000000
--- a/qt_tstfrm/gui_test_widget.hpp
+++ /dev/null
@@ -1,157 +0,0 @@
-#pragma once
-
-#include "gl_test_widget.hpp"
-#include "gui/controller.hpp"
-#include "base/strings_bundle.hpp"
-#include <QMouseEvent>
-#include <QObject>
-#include <QTimerEvent>
-
-template <class T, void (T::*)(gui::Controller*)>
-struct init_with_controller_fn_bind
-{
- typedef T type;
-};
-
-template <class T, class U>
-struct has_init_with_controller
-{
- static bool const value = false;
-};
-
-template <class T>
-struct has_init_with_controller<T, typename init_with_controller_fn_bind<T, &T::Init>::type>
-{
- static bool const value = true;
-};
-
-template <typename TTest>
-class GUITestWidget : public GLTestWidget<TTest>
-{
-private:
-
- typedef GLTestWidget<TTest> base_t;
-
- shared_ptr<gui::Controller> m_controller;
- shared_ptr<graphics::Screen> m_cacheScreen;
- shared_ptr<StringsBundle> m_stringBundle;
-
- shared_ptr<QObject> m_timerObj;
- int m_timerID;
-
-public:
-
- void invalidate()
- {
- base_t::updateGL();
- }
-
- void initializeGL()
- {
- m_timerObj.reset(new QObject());
- m_timerObj->installEventFilter(this);
- m_timerID = m_timerObj->startTimer(1000 / 60);
-
- base_t::initializeGL();
-
- m_controller.reset(new gui::Controller());
-
- gui::Controller::RenderParams rp;
-
- graphics::Screen::Params cp;
-
- cp.m_threadSlot = 0;
- cp.m_storageType = graphics::ETinyStorage;
- cp.m_textureType = graphics::ESmallTexture;
- cp.m_resourceManager = base_t::m_resourceManager;
- cp.m_renderContext = base_t::m_primaryContext;
-
- m_cacheScreen.reset(new graphics::Screen(cp));
-
- rp.m_CacheScreen = m_cacheScreen.get();
- rp.m_GlyphCache = base_t::m_resourceManager->glyphCache(0);
- rp.m_InvalidateFn = bind(&GUITestWidget<TTest>::invalidate, this);
- rp.m_Density = graphics::EDensityMDPI;
-
- m_stringBundle.reset(new StringsBundle());
- m_stringBundle->SetDefaultString("country_status_download", "Download^");
-
- m_controller->SetStringsBundle(m_stringBundle.get());
-
- InitImpl(m_controller, bool_tag<has_init_with_controller<TTest, TTest>::value >());
-
- m_controller->SetRenderParams(rp);
- }
-
- void InitImpl(shared_ptr<gui::Controller> const & c, bool_tag<true> const &)
- {
- base_t::test.Init(c.get());
- }
-
- void InitImpl(shared_ptr<gui::Controller> const & c, bool_tag<false> const &)
- {}
-
- void DoDraw(shared_ptr<graphics::Screen> const & s)
- {
- base_t::DoDraw(s);
- m_controller->UpdateElements();
- m_controller->DrawFrame(s.get());
- }
-
- void mousePressEvent(QMouseEvent * e)
- {
- base_t::mousePressEvent(e);
-
- if (e->button() == Qt::LeftButton)
- m_controller->OnTapStarted(m2::PointU(e->pos().x(), e->pos().y()));
- }
-
- void mouseReleaseEvent(QMouseEvent * e)
- {
- base_t::mouseReleaseEvent(e);
-
- if (e->button() == Qt::LeftButton)
- m_controller->OnTapEnded(m2::PointU(e->pos().x(), e->pos().y()));
- }
-
- void mouseMoveEvent(QMouseEvent * e)
- {
- base_t::mouseMoveEvent(e);
-
- m_controller->OnTapMoved(m2::PointU(e->pos().x(), e->pos().y()));
- }
-
- bool eventFilter(QObject * obj, QEvent *event)
- {
- if (obj == m_timerObj.get() && event->type() == QEvent::Timer)
- {
- if (((QTimerEvent *)event)->timerId() == m_timerID)
- {
- invalidate();
- return true;
- }
- }
-
- return false;
- }
-};
-
-template <class Test> QWidget * create_gui_test_widget()
-{
- GUITestWidget<Test> * w = new GUITestWidget<Test>();
- w->Init();
- return w;
-}
-
-#define UNIT_TEST_GUI(name)\
- void UnitTestGUI_##name();\
- TestRegister g_TestRegisterGUI_##name("Test::"#name, __FILE__, &UnitTestGUI_##name);\
- void UnitTestGUI_##name()\
- {\
- char * argv[] = { const_cast<char *>(#name) };\
- int argc = 1;\
- QApplication app(argc, argv);\
- QWidget * w = create_gui_test_widget<name>();\
- w->show();\
- app.exec();\
- }
diff --git a/qt_tstfrm/macros.hpp b/qt_tstfrm/macros.hpp
deleted file mode 100644
index 23b349daf9..0000000000
--- a/qt_tstfrm/macros.hpp
+++ /dev/null
@@ -1,3 +0,0 @@
-#pragma once
-
-#include "qt_tstfrm/gl_test_widget.hpp"
diff --git a/qt_tstfrm/tstwidgets.cpp b/qt_tstfrm/tstwidgets.cpp
deleted file mode 100644
index 3932f4d15e..0000000000
--- a/qt_tstfrm/tstwidgets.cpp
+++ /dev/null
@@ -1,146 +0,0 @@
-#include "qt_tstfrm/tstwidgets.hpp"
-
-#include "render/render_policy.hpp"
-
-#include "graphics/screen.hpp"
-#include "graphics/resource_manager.hpp"
-
-#include "graphics/opengl/utils.hpp"
-#include "graphics/opengl/framebuffer.hpp"
-#include "graphics/opengl/renderbuffer.hpp"
-#include "graphics/opengl/opengl.hpp"
-
-#include "platform/platform.hpp"
-
-namespace tst
-{
- void GLDrawWidget::initializeGL()
- {
- try
- {
- graphics::gl::InitExtensions();
- graphics::gl::CheckExtensionSupport();
- }
- catch (graphics::gl::platform_unsupported & e)
- {
- /// TODO: Show "Please Update Drivers" dialog and close the program.
- }
-
- m_primaryContext.reset(new qt::gl::RenderContext(this));
-
- graphics::ResourceManager::Params rmp;
- rmp.m_texFormat = graphics::Data8Bpp;
-
- rmp.m_videoMemoryLimit = 20 * 1024 * 1024;
-
- graphics::ResourceManager::StoragePoolParams spp;
- graphics::ResourceManager::TexturePoolParams tpp;
-
- spp = graphics::ResourceManager::StoragePoolParams(30000 * sizeof(graphics::gl::Vertex),
- sizeof(graphics::gl::Vertex),
- 50000 * sizeof(unsigned short),
- sizeof(unsigned short),
- 1,
- graphics::ELargeStorage,
- true);
-
- rmp.m_storageParams[graphics::ELargeStorage] = spp;
-
- spp = graphics::ResourceManager::StoragePoolParams(3000 * sizeof(graphics::gl::Vertex),
- sizeof(graphics::gl::Vertex),
- 5000 * sizeof(unsigned short),
- sizeof(unsigned short),
- 1,
- graphics::EMediumStorage,
- true);
-
- rmp.m_storageParams[graphics::EMediumStorage] = spp;
-
- spp = graphics::ResourceManager::StoragePoolParams(500 * sizeof(graphics::gl::Vertex),
- sizeof(graphics::gl::Vertex),
- 500 * sizeof(unsigned short),
- sizeof(unsigned short),
- 1,
- graphics::ESmallStorage,
- true);
-
- rmp.m_storageParams[graphics::ESmallStorage] = spp;
-
- spp = graphics::ResourceManager::StoragePoolParams(100 * sizeof(graphics::gl::Vertex),
- sizeof(graphics::gl::Vertex),
- 200 * sizeof(unsigned short),
- sizeof(unsigned short),
- 1,
- graphics::ETinyStorage,
- true);
-
- rmp.m_storageParams[graphics::ETinyStorage] = spp;
-
-
- tpp = graphics::ResourceManager::TexturePoolParams(512,
- 512,
- 1,
- rmp.m_texFormat,
- graphics::ELargeTexture,
- true);
-
- rmp.m_textureParams[graphics::ELargeTexture] = tpp;
-
- tpp = graphics::ResourceManager::TexturePoolParams(256,
- 256,
- 1,
- rmp.m_texFormat,
- graphics::EMediumTexture,
- true);
-
- rmp.m_textureParams[graphics::EMediumTexture] = tpp;
-
- tpp = graphics::ResourceManager::TexturePoolParams(128,
- 128,
- 1,
- rmp.m_texFormat,
- graphics::ESmallTexture,
- true);
-
- rmp.m_textureParams[graphics::ESmallTexture] = tpp;
-
-
- rmp.m_glyphCacheParams = GetResourceGlyphCacheParams(graphics::EDensityMDPI);
-
- rmp.m_threadSlotsCount = 1;
- rmp.m_renderThreadsCount = 0;
-
- rmp.m_useSingleThreadedOGL = false;
-
- m_resourceManager.reset(new graphics::ResourceManager(rmp, "basic.skn", graphics::EDensityMDPI));
-
- m_primaryContext->setResourceManager(m_resourceManager);
- m_primaryContext->startThreadDrawing(0);
-
- Platform::FilesList fonts;
- GetPlatform().GetFontNames(fonts);
- m_resourceManager->addFonts(fonts);
-
- graphics::Screen::Params params;
-
- m_primaryFrameBuffer.reset(new graphics::gl::FrameBuffer(true));
-
- params.m_frameBuffer = m_primaryFrameBuffer;
- params.m_resourceManager = m_resourceManager;
- params.m_threadSlot = m_resourceManager->guiThreadSlot();
- params.m_renderContext = m_primaryContext;
-
- m_primaryScreen.reset(new graphics::Screen(params));
- }
-
- void GLDrawWidget::resizeGL(int w, int h)
- {
- m_primaryScreen->onSize(w, h);
- m_primaryFrameBuffer->onSize(w, h);
- }
-
- void GLDrawWidget::paintGL()
- {
- DoDraw(m_primaryScreen);
- }
-}
diff --git a/qt_tstfrm/tstwidgets.hpp b/qt_tstfrm/tstwidgets.hpp
deleted file mode 100644
index a02ab3fa47..0000000000
--- a/qt_tstfrm/tstwidgets.hpp
+++ /dev/null
@@ -1,45 +0,0 @@
-#pragma once
-
-#include "graphics/opengl/texture.hpp"
-#include "graphics/opengl/renderbuffer.hpp"
-#include "graphics/opengl/framebuffer.hpp"
-
-#include "graphics/screen.hpp"
-
-#include "graphics/resource_manager.hpp"
-
-#include "map/qgl_render_context.hpp"
-
-#include "std/shared_ptr.hpp"
-
-#include <QtOpenGL/QGLWidget>
-
-namespace graphics
-{
- namespace gl
- {
- class Screen;
- }
-}
-
-namespace tst
-{
- class GLDrawWidget : public QGLWidget
- {
- public:
-
- shared_ptr<graphics::ResourceManager> m_resourceManager;
-
- shared_ptr<graphics::gl::FrameBuffer> m_primaryFrameBuffer;
- shared_ptr<qt::gl::RenderContext> m_primaryContext;
- shared_ptr<graphics::Screen> m_primaryScreen;
-
- virtual void initializeGL();
- virtual void resizeGL(int w, int h);
- virtual void paintGL();
-
- public:
-
- virtual void DoDraw(shared_ptr<graphics::Screen> const & screen) = 0;
- };
-}