19 #include "ui_vp13dstandardchannelsnapshotgroupbox.h"
28 #include <Inventor/C/errors/debugerror.h>
29 #include <Inventor/actions/SoLineHighlightRenderAction.h>
30 #include <Inventor/actions/SoBoxHighlightRenderAction.h>
31 #include <Inventor/nodes/SoPerspectiveCamera.h>
32 #include <Inventor/SoOffscreenRenderer.h>
35 #include <QVBoxLayout>
107 const QString & contact_info,
bool detectorViewButtons)
118 m_d->
root->setName(
"StandardChannelWidgetSceneRoot");
158 if (allowController) {
163 if (allowExtraDisplayWidget)
171 QWidget * snapshotgroupbox =
new QWidget();
179 colorselectbutton_dummy,
180 snapshotgroupbox,
true ));
182 SoOffscreenRenderer::getMaximumResolution().getValue(
x,
y);
205 while (
it.hasNext()) {
210 it.key()->setChecked(
false);
222 QList<QPair<QString,QWidget*> > sysname2extradisplay;
224 QWidget * edwidget =
sys->buildExtraDisplayWidget();
226 sysname2extradisplay << QPair<QString,QWidget*>(
sys->name(),edwidget);
229 if (sysname2extradisplay.count()==0) {
232 }
else if (sysname2extradisplay.count()==1) {
234 }
else if (sysname2extradisplay.count()>1) {
236 for (
int i = 0;
i < sysname2extradisplay.count(); ++
i) {
237 tabWidget->addTab(sysname2extradisplay.at(
i).second,sysname2extradisplay.at(
i).first);
239 tabWidget->setCurrentIndex(0);
246 m_d->
viewer->setGLRenderAction(
new SoLineHighlightRenderAction());
274 QVBoxLayout * vboxLayout =
new QVBoxLayout(
channel);
275 vboxLayout->setContentsMargins(0, 0, 0, 0);
280 widget_viewer->setObjectName(
"widget_viewer");
296 unsigned long long eventnumber(0);
299 #if defined BUILDVP1LIGHT
305 QFileInfo snapshotDir(snapshotDirName);
306 if(!snapshotDir.exists()||!snapshotDir.isDir()||!snapshotDir.isReadable()||!snapshotDir.isWritable()) {
307 channel->message(
"The directory for storing VP1 snapshots "+snapshotDirName+
" either does not exist or is not writable");
312 QString chnlname =
channel->name().toLower();
313 chnlname.replace(
' ',
'_');
322 QPixmap pm =
channel->getSnapshot();
370 QCheckBox * cb =
static_cast<QCheckBox*
>(sender()); assert(cb);
379 assert(checkbox2system.contains(cb));
382 assert(system2rootNodes.contains(
sys));
383 SoSeparator * sysroot = system2rootNodes.value(
sys);
384 int ichild =
root->findChild(sysroot);
385 if (cb->isChecked()) {
388 root->addChild(sysroot);
390 if (tabwidget&&sys2tabpage.contains(
sys)) {
391 int sysindex = systemsAllowedControllers.indexOf(
sys);
394 for (
int i=sysindex+1;
i<systemsAllowedControllers.count();++
i) {
398 IVP1System* testsys = systemsAllowedControllers.at(
i);
399 if (sys2tabpage.contains(testsys)&&tabwidget->indexOf(sys2tabpage[testsys])>-1) {
405 int index = (nextsystem?tabwidget->indexOf(sys2tabpage[nextsystem]):99999);
406 tabwidget->insertTab(
index,sys2tabpage[
sys],
sys->name());
407 int index2 = tabwidget->indexOf(sys2tabpage[
sys]);
409 tabwidget->setTabEnabled(
index2,
true);
418 root->removeChild(ichild);
419 if (tabwidget&&sys2tabpage.contains(
sys)) {
420 int index = tabwidget->indexOf(sys2tabpage[
sys]);
422 tabwidget->setTabEnabled(
index,
false);
423 tabwidget->removeTab(
index);
470 int original_width = 0;
480 VP1Msg::messageVerbose(
"'transp' option set - using VP1QtInventorUtils::renderToPixmap() with transp set to 'true'");
491 VP1Msg::messageVerbose(
"save the screenshot with the default tool (with settings from GUI) - using VP1QtInventorUtils::renderToPixmap()");
562 int onscreen_width =
m_d->
viewer->getNormalWidget()->geometry().width();
563 int onscreen_height =
m_d->
viewer->getNormalWidget()->geometry().height();
577 m_d->
uisnapshot.spinBox_height->setValue(
static_cast<int>(
m_d->
uisnapshot.spinBox_width->value()*
static_cast<double>(onscreen_height)/onscreen_width+0.5));
581 m_d->
uisnapshot.spinBox_width->setValue(
static_cast<int>(
m_d->
uisnapshot.spinBox_height->value()*
static_cast<double>(onscreen_width)/onscreen_height+0.5));
604 m_d->
uisnapshot.spinBox_height->setValue(
static_cast<int>(
m_d->
uisnapshot.spinBox_width->value()*
static_cast<double>(onscreen_height)/onscreen_width+0.5));
612 m_d->
uisnapshot.spinBox_width->setValue(
static_cast<int>(
m_d->
uisnapshot.spinBox_height->value()*
static_cast<double>(onscreen_width)/onscreen_width+0.5));
714 QByteArray byteArray;
715 QBuffer
buffer(&byteArray);
716 buffer.open(QIODevice::WriteOnly);
731 QMap<QString, bool> sysname2turnedon;
734 sysname2turnedon.insert(
it.key()->text(),
it.key()->isChecked());
740 out << sysname2turnedon;
749 bool widthfixed =
m_d->
uisnapshot.radioButton_width->isChecked();
750 bool as_shown =
m_d->
uisnapshot.checkBox_as_shown->isChecked();
777 buffer.open(QIODevice::ReadOnly);
785 if (version<0||version>7) {
786 message(
"Warning: State data in .vp1 file is in wrong format - ignoring!");
790 QByteArray basestate;
802 state >> bgdcol_dummy;
806 QMap<QString, bool> sysname2turnedon;
807 state >> sysname2turnedon;
810 if (sysname2turnedon.contains(
it.key()->text())) {
811 if (sysname2turnedon[
it.key()->text()]!=
it.key()->isChecked())
812 it.key()->setChecked(sysname2turnedon[
it.key()->text()]);
814 message(
"Warning: Config data does not contain information about switched state of subsystem '"+
it.key()->text()+
"'");
826 QByteArray splitstate;
832 QByteArray ba_viewer;
838 bool aa_dummy, transp, widthfixed, as_shown;
888 message(
"showControlsForSystem Error: Unable to determine system identity.");
897 if (index<0||!m_d->tabwidget->isTabEnabled(
index)) {
898 message(
"Warning: Asked to show controller for a disabled system. Surely you jest?");
914 QMap<QString, bool> sysname2turnedon;
916 QByteArray splitstate;
918 QByteArray ba_viewer;
920 bool transp, widthfixed, as_shown;
922 qint32
width, height;
938 state >> sysname2turnedon;
944 state >> locked_ratio;
947 state >> isUsingPresets;
963 QMap<QCheckBox*,IVP1System*>::const_iterator
it = checkbox2system.constBegin();
964 while (
it != checkbox2system.constEnd()) {
965 if (sysname2turnedon.contains(
it.key()->text())) {
966 if (sysname2turnedon[
it.key()->text()]!=
it.key()->isChecked())
967 it.key()->setChecked(sysname2turnedon[
it.key()->text()]);
969 channel->message(
"Warning: Config data does not contain information about switched state of subsystem '"+
it.key()->text()+
"'");
976 if (extradisplaywidget_splitter)
977 extradisplaywidget_splitter->restoreState(splitstate);
980 viewer->restoreFromState(ba_viewer);
981 need_initial_viewall =
false;
985 uisnapshot.checkBox_transp->setChecked(transp);
986 uisnapshot.checkBox_as_shown->setChecked(as_shown);
988 uisnapshot.radioButton_width->setChecked(
true);
989 uisnapshot.radioButton_height->setChecked(
false);
991 uisnapshot.radioButton_width->setChecked(
false);
992 uisnapshot.radioButton_height->setChecked(
true);
995 uisnapshot.spinBox_width->setValue(
width);
996 uisnapshot.spinBox_height->setValue(height);
1001 uisnapshot.groupBox_imagePresets->setChecked(
true);
1003 uisnapshot.radioButton_720p->setChecked(
true);
1005 uisnapshot.radioButton_1080p->setChecked(
true);
1007 uisnapshot.radioButton_4K->setChecked(
true);
1009 uisnapshot.radioButton_8K->setChecked(
true);
1014 for (
int i = 0;
i < tabwidget->count(); ++
i) {
1015 if (tabwidget->tabText(
i) == tabname) {
1016 tabwidget->setCurrentIndex(
i);