Developer Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
LoggerHandling.cc
1 /*===========================================================================*\
2 * *
3 * OpenFlipper *
4  * Copyright (c) 2001-2015, RWTH-Aachen University *
5  * Department of Computer Graphics and Multimedia *
6  * All rights reserved. *
7  * www.openflipper.org *
8  * *
9  *---------------------------------------------------------------------------*
10  * This file is part of OpenFlipper. *
11  *---------------------------------------------------------------------------*
12  * *
13  * Redistribution and use in source and binary forms, with or without *
14  * modification, are permitted provided that the following conditions *
15  * are met: *
16  * *
17  * 1. Redistributions of source code must retain the above copyright notice, *
18  * this list of conditions and the following disclaimer. *
19  * *
20  * 2. Redistributions in binary form must reproduce the above copyright *
21  * notice, this list of conditions and the following disclaimer in the *
22  * documentation and/or other materials provided with the distribution. *
23  * *
24  * 3. Neither the name of the copyright holder nor the names of its *
25  * contributors may be used to endorse or promote products derived from *
26  * this software without specific prior written permission. *
27  * *
28  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
29  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
30  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
31  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
32  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
33  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
34  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
35  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
36  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
37  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
38  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
39 * *
40 \*===========================================================================*/
41 
42 /*===========================================================================*\
43 * *
44 * $Revision$ *
45 * $LastChangedBy$ *
46 * $Date$ *
47 * *
48 \*===========================================================================*/
49 
51 
55 
56  switch (OpenFlipper::Options::loggerState()) {
57  case OpenFlipper::Options::InScene:
58  OpenFlipper::Options::loggerState(OpenFlipper::Options::Normal);
59  break;
61  OpenFlipper::Options::loggerState(OpenFlipper::Options::Hidden);
62  break;
63  case OpenFlipper::Options::Hidden:
64  OpenFlipper::Options::loggerState(OpenFlipper::Options::InScene);
65  break;
66  }
67 
68  // Hide/Show Logger
69  showLogger(OpenFlipper::Options::loggerState());
70 }
71 
72 //-----------------------------------------------------------------------------
73 
76 void CoreWidget::showLogger(OpenFlipper::Options::LoggerState _state) {
77 
78  //Hide Logger
79  if (_state == loggerState_)
80  return;
81 
82  switch (_state) {
83  case OpenFlipper::Options::InScene: {
84 
85  showLoggerInSplitView(false);
86  logWidget_->resize(logWidget_->width(), originalLoggerSize_);
87 
89 
90  break;
91  }
93 
95 
97 
98  logWidget_->show();
99 
100  break;
101  }
102  case OpenFlipper::Options::Hidden: {
103 
104  if (loggerState_ == OpenFlipper::Options::InScene)
106 
107  showLoggerInSplitView(false);
108 
109  break;
110  }
111  } // End switch
112 
113  loggerState_ = _state;
114 }
115 
116 //-----------------------------------------------------------------------------
117 
119 
120  if(!_show) {
121 
122  QList<int> wsizes = splitter_->sizes();
123 
124  // Remember old size
126  if(wsizes.size() > 1) {
127  originalLoggerSize_ = wsizes[1];
128  } else {
129  originalLoggerSize_ = 240;
130  }
131  }
132 
133  if (originalLoggerSize_ == 0)
134  originalLoggerSize_ = 240;
135 
136  logWidget_->setParent(0);
137  wsizes[0] = 1;
138  splitter_->setSizes(wsizes);
139  } else {
140 
141  if (loggerState_ == OpenFlipper::Options::InScene)
142  originalLoggerSize_ = logWidget_->height();
143 
144  if (originalLoggerSize_ == 0)
145  originalLoggerSize_ = 240;
146 
147  logWidget_->setParent(splitter_);
148  splitter_->insertWidget(1, logWidget_);
149  QList<int> wsizes = splitter_->sizes();
150  int totalHeight = wsizes[0] + wsizes[1];
151  wsizes[1] = originalLoggerSize_;
152  wsizes[0] = totalHeight - originalLoggerSize_;
153  splitter_->setSizes(wsizes);
154  }
155 }
156 
157 //-----------------------------------------------------------------------------
158 
160 
161  if(loggerState_ == OpenFlipper::Options::InScene) {
163  }
164 }
LoggerWidget * logWidget_
Textedit at the bottom for log messages.
Definition: CoreWidget.hh:678
void showLogger(OpenFlipper::Options::LoggerState _state)
Change visibility of the logger.
void toggleLogger()
Hide or show logging area.
void updateGeometry()
recalculate geometry
QSplitter * splitter_
Spliter between toplevel objects and the textedit at the bottom.
Definition: CoreWidget.hh:672
void detachWidget()
detach child widget
QtSlideWindow * slidingLogger_
Class that holds the animated log widget.
Definition: CoreWidget.hh:714
void attachWidget(QWidget *_m)
attach a child widget
void showLoggerInSplitView(bool _show)
Show logger in splitter or not.
OpenFlipper::Options::LoggerState loggerState_
Show logger in splitter or not.
Definition: CoreWidget.hh:560
Add normals to mesh item (vertices/faces)
Definition: Attributes.hh:87
void updateInSceneLoggerGeometry()
Set in-scene logger geometry right.
int originalLoggerSize_
Size of the logging window ( defaults to 240 )
Definition: CoreWidget.hh:681