goat3d

diff goatview/src/goatview.cc @ 73:9862541fdcf5

- build qt goatview on linux - fixed line endings in a bunch of files
author John Tsiombikas <nuclear@member.fsf.org>
date Tue, 06 May 2014 03:57:11 +0300
parents 36e39632db75
children ab66cdabf6f2
line diff
     1.1 --- a/goatview/src/goatview.cc	Tue May 06 03:31:35 2014 +0300
     1.2 +++ b/goatview/src/goatview.cc	Tue May 06 03:57:11 2014 +0300
     1.3 @@ -1,117 +1,117 @@
     1.4 -#include "goatview.h"
     1.5 -
     1.6 -GoatView::GoatView()
     1.7 -{
     1.8 -	make_menu();
     1.9 -	make_dock();
    1.10 -	make_center();
    1.11 -
    1.12 -	statusBar();
    1.13 -
    1.14 -	setWindowTitle("GoatView");
    1.15 -}
    1.16 -
    1.17 -GoatView::~GoatView()
    1.18 -{
    1.19 -}
    1.20 -
    1.21 -bool GoatView::make_menu()
    1.22 -{
    1.23 -	QMenu *menu_file = menuBar()->addMenu("&File");
    1.24 -
    1.25 -	QAction *act_open_sce = new QAction("&Open Scene", this);
    1.26 -	act_open_sce->setShortcuts(QKeySequence::Open);
    1.27 -	connect(act_open_sce, &QAction::triggered, this, &GoatView::open_scene);
    1.28 -	menu_file->addAction(act_open_sce);
    1.29 -
    1.30 -	QAction *act_open_anm = new QAction("Open &Animation", this);
    1.31 -	connect(act_open_anm, &QAction::triggered, this, &GoatView::open_anim);
    1.32 -	menu_file->addAction(act_open_anm);
    1.33 -
    1.34 -	QAction *act_quit = new QAction("&Quit", this);
    1.35 -	act_quit->setShortcuts(QKeySequence::Quit);
    1.36 -	connect(act_quit, &QAction::triggered, [&](){qApp->quit();});
    1.37 -	menu_file->addAction(act_quit);
    1.38 -	return true;
    1.39 -}
    1.40 -
    1.41 -bool GoatView::make_dock()
    1.42 -{
    1.43 -	// ---- side-dock ----
    1.44 -	QWidget *dock_cont = new QWidget;
    1.45 -	QVBoxLayout *dock_vbox = new QVBoxLayout;
    1.46 -	dock_cont->setLayout(dock_vbox);
    1.47 -
    1.48 -	QPushButton *bn_quit = new QPushButton("quit");
    1.49 -	dock_vbox->addWidget(bn_quit);
    1.50 -	connect(bn_quit, &QPushButton::clicked, [&](){qApp->quit();});
    1.51 -
    1.52 -	QDockWidget *dock = new QDockWidget("Scene graph", this);
    1.53 -	dock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
    1.54 -	dock->setWidget(dock_cont);
    1.55 -	addDockWidget(Qt::LeftDockWidgetArea, dock);
    1.56 -
    1.57 -	// ---- bottom dock ----
    1.58 -	dock_cont = new QWidget;
    1.59 -	QHBoxLayout *dock_hbox = new QHBoxLayout;
    1.60 -	dock_cont->setLayout(dock_hbox);
    1.61 -
    1.62 -	QSlider *slider_time = new QSlider(Qt::Orientation::Horizontal);
    1.63 -	slider_time->setDisabled(true);
    1.64 -	dock_hbox->addWidget(slider_time);
    1.65 -
    1.66 -	dock = new QDockWidget("Animation", this);
    1.67 -	dock->setAllowedAreas(Qt::BottomDockWidgetArea);
    1.68 -	dock->setWidget(dock_cont);
    1.69 -	addDockWidget(Qt::BottomDockWidgetArea, dock);
    1.70 -
    1.71 -	return true;
    1.72 -}
    1.73 -
    1.74 -bool GoatView::make_center()
    1.75 -{
    1.76 -	GoatViewport *vport = new GoatViewport;
    1.77 -	setCentralWidget(vport);
    1.78 -	return true;
    1.79 -}
    1.80 -
    1.81 -void GoatView::open_scene()
    1.82 -{
    1.83 -	statusBar()->showMessage("opening scene...");
    1.84 -}
    1.85 -
    1.86 -void GoatView::open_anim()
    1.87 -{
    1.88 -	statusBar()->showMessage("opening animation...");
    1.89 -}
    1.90 -
    1.91 -
    1.92 -// ---- OpenGL viewport ----
    1.93 -GoatViewport::GoatViewport()
    1.94 -	: QGLWidget(QGLFormat(QGL::DepthBuffer))
    1.95 -{
    1.96 -}
    1.97 -
    1.98 -GoatViewport::~GoatViewport()
    1.99 -{
   1.100 -}
   1.101 -
   1.102 -QSize GoatViewport::sizeHint() const
   1.103 -{
   1.104 -	return QSize(800, 600);
   1.105 -}
   1.106 -
   1.107 -void GoatViewport::initializeGL()
   1.108 -{
   1.109 -}
   1.110 -
   1.111 -void GoatViewport::resizeGL(int xsz, int ysz)
   1.112 -{
   1.113 -	glViewport(0, 0, xsz, ysz);
   1.114 -}
   1.115 -
   1.116 -void GoatViewport::paintGL()
   1.117 -{
   1.118 -	glClearColor(1, 0, 0, 1);
   1.119 -	glClear(GL_COLOR_BUFFER_BIT);
   1.120 -}
   1.121 \ No newline at end of file
   1.122 +#include "goatview.h"
   1.123 +
   1.124 +GoatView::GoatView()
   1.125 +{
   1.126 +	make_menu();
   1.127 +	make_dock();
   1.128 +	make_center();
   1.129 +
   1.130 +	statusBar();
   1.131 +
   1.132 +	setWindowTitle("GoatView");
   1.133 +}
   1.134 +
   1.135 +GoatView::~GoatView()
   1.136 +{
   1.137 +}
   1.138 +
   1.139 +bool GoatView::make_menu()
   1.140 +{
   1.141 +	QMenu *menu_file = menuBar()->addMenu("&File");
   1.142 +
   1.143 +	QAction *act_open_sce = new QAction("&Open Scene", this);
   1.144 +	act_open_sce->setShortcuts(QKeySequence::Open);
   1.145 +	connect(act_open_sce, &QAction::triggered, this, &GoatView::open_scene);
   1.146 +	menu_file->addAction(act_open_sce);
   1.147 +
   1.148 +	QAction *act_open_anm = new QAction("Open &Animation", this);
   1.149 +	connect(act_open_anm, &QAction::triggered, this, &GoatView::open_anim);
   1.150 +	menu_file->addAction(act_open_anm);
   1.151 +
   1.152 +	QAction *act_quit = new QAction("&Quit", this);
   1.153 +	act_quit->setShortcuts(QKeySequence::Quit);
   1.154 +	connect(act_quit, &QAction::triggered, [&](){qApp->quit();});
   1.155 +	menu_file->addAction(act_quit);
   1.156 +	return true;
   1.157 +}
   1.158 +
   1.159 +bool GoatView::make_dock()
   1.160 +{
   1.161 +	// ---- side-dock ----
   1.162 +	QWidget *dock_cont = new QWidget;
   1.163 +	QVBoxLayout *dock_vbox = new QVBoxLayout;
   1.164 +	dock_cont->setLayout(dock_vbox);
   1.165 +
   1.166 +	QPushButton *bn_quit = new QPushButton("quit");
   1.167 +	dock_vbox->addWidget(bn_quit);
   1.168 +	connect(bn_quit, &QPushButton::clicked, [&](){qApp->quit();});
   1.169 +
   1.170 +	QDockWidget *dock = new QDockWidget("Scene graph", this);
   1.171 +	dock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
   1.172 +	dock->setWidget(dock_cont);
   1.173 +	addDockWidget(Qt::LeftDockWidgetArea, dock);
   1.174 +
   1.175 +	// ---- bottom dock ----
   1.176 +	dock_cont = new QWidget;
   1.177 +	QHBoxLayout *dock_hbox = new QHBoxLayout;
   1.178 +	dock_cont->setLayout(dock_hbox);
   1.179 +
   1.180 +	QSlider *slider_time = new QSlider(Qt::Orientation::Horizontal);
   1.181 +	slider_time->setDisabled(true);
   1.182 +	dock_hbox->addWidget(slider_time);
   1.183 +
   1.184 +	dock = new QDockWidget("Animation", this);
   1.185 +	dock->setAllowedAreas(Qt::BottomDockWidgetArea);
   1.186 +	dock->setWidget(dock_cont);
   1.187 +	addDockWidget(Qt::BottomDockWidgetArea, dock);
   1.188 +
   1.189 +	return true;
   1.190 +}
   1.191 +
   1.192 +bool GoatView::make_center()
   1.193 +{
   1.194 +	GoatViewport *vport = new GoatViewport;
   1.195 +	setCentralWidget(vport);
   1.196 +	return true;
   1.197 +}
   1.198 +
   1.199 +void GoatView::open_scene()
   1.200 +{
   1.201 +	statusBar()->showMessage("opening scene...");
   1.202 +}
   1.203 +
   1.204 +void GoatView::open_anim()
   1.205 +{
   1.206 +	statusBar()->showMessage("opening animation...");
   1.207 +}
   1.208 +
   1.209 +
   1.210 +// ---- OpenGL viewport ----
   1.211 +GoatViewport::GoatViewport()
   1.212 +	: QGLWidget(QGLFormat(QGL::DepthBuffer))
   1.213 +{
   1.214 +}
   1.215 +
   1.216 +GoatViewport::~GoatViewport()
   1.217 +{
   1.218 +}
   1.219 +
   1.220 +QSize GoatViewport::sizeHint() const
   1.221 +{
   1.222 +	return QSize(800, 600);
   1.223 +}
   1.224 +
   1.225 +void GoatViewport::initializeGL()
   1.226 +{
   1.227 +}
   1.228 +
   1.229 +void GoatViewport::resizeGL(int xsz, int ysz)
   1.230 +{
   1.231 +	glViewport(0, 0, xsz, ysz);
   1.232 +}
   1.233 +
   1.234 +void GoatViewport::paintGL()
   1.235 +{
   1.236 +	glClearColor(1, 0, 0, 1);
   1.237 +	glClear(GL_COLOR_BUFFER_BIT);
   1.238 +}