# HG changeset patch # User John Tsiombikas # Date 1334431934 -10800 # Node ID c1dd5b1205047359897a8af914b2f46757c31fe5 # Parent 40df2cdc63234c161385fbb1d474a63e76038990 separated the transfer function to a different subwindow and added shortcut for quit diff -r 40df2cdc6323 -r c1dd5b120504 src/ui.cc --- a/src/ui.cc Sat Apr 14 22:10:30 2012 +0300 +++ b/src/ui.cc Sat Apr 14 22:32:14 2012 +0300 @@ -20,12 +20,18 @@ setCentralWidget(maingl); glwlist.push_back(maingl); - // side-window + // slice view sub-window sidewin = new SideWindow; sidewin->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); sidewin->setFeatures(QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable); addDockWidget(Qt::LeftDockWidgetArea, sidewin); + // transfer function sub-window + xferwin = new XFerWin; + xferwin->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); + xferwin->setFeatures(QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable); + addDockWidget(Qt::LeftDockWidgetArea, xferwin); + // actions QAction *act_open = new QAction(qApp->style()->standardIcon(QStyle::SP_DialogOpenButton), "&Open...", this); act_open->setStatusTip("Open a volume dataset"); @@ -33,6 +39,8 @@ QAction *act_quit = new QAction("&Quit", this); act_quit->setStatusTip("Quit"); + //act_quit->setShortcut(QKeySequence(QKeySequence::Quit)); + act_quit->setShortcut(QKeySequence(tr("Ctrl+Q", "File|Quit"))); QObject::connect(act_quit, SIGNAL(triggered()), this, SLOT(close())); // menus @@ -92,6 +100,29 @@ group_slice->setLayout(vbox); } + QWidget *win = new QWidget; + setWidget(win); + + QVBoxLayout *vbox = new QVBoxLayout; + vbox->addWidget(group_slice); + vbox->addStretch(); + + win->setLayout(vbox); +} + +void SideWindow::zslider_change(int val) +{ + volray_setvalue(VolRayOpt::ZCURSOR, (float)val / 256.0); +} + +void SideWindow::clip_change(int checked) +{ + volray_setvalue(VolRayOpt::ZCLIP, checked); +} + + +XFerWin::XFerWin() +{ QGroupBox *group_xfer = new QGroupBox("Transfer function"); { XFerGLView *xfer_view = new XFerGLView(glwlist[0]); @@ -107,23 +138,12 @@ setWidget(win); QVBoxLayout *vbox = new QVBoxLayout; - vbox->addWidget(group_slice); vbox->addWidget(group_xfer); vbox->addStretch(); win->setLayout(vbox); } -void SideWindow::zslider_change(int val) -{ - volray_setvalue(VolRayOpt::ZCURSOR, (float)val / 256.0); -} - -void SideWindow::clip_change(int checked) -{ - volray_setvalue(VolRayOpt::ZCLIP, checked); -} - void post_redisplay() { diff -r 40df2cdc6323 -r c1dd5b120504 src/ui.h --- a/src/ui.h Sat Apr 14 22:10:30 2012 +0300 +++ b/src/ui.h Sat Apr 14 22:32:14 2012 +0300 @@ -6,6 +6,8 @@ #include "volray.h" class SideWindow; +class XFerWin; + class MainGLView; class SliceGLView; class XFerGLView; @@ -17,6 +19,7 @@ MainGLView *maingl; SideWindow *sidewin; + XFerWin *xferwin; private slots: void open_volume(); @@ -33,7 +36,6 @@ Q_OBJECT SliceGLView *slice_view; - XFerGLView *xfer_view; private slots: void zslider_change(int val); @@ -43,6 +45,16 @@ SideWindow(); }; +class XFerWin : public QDockWidget { +private: + Q_OBJECT + + XFerGLView *xfer_view; + +public: + XFerWin(); +}; + // call to force a redisplay on all GL views void post_redisplay();