Commit 45dc6722 authored by Jan Möbius's avatar Jan Möbius

Dennis: Various Log Viewer fixes

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@5066 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 8bf5584b
...@@ -752,9 +752,13 @@ void Core::fullscreen( bool _state ) { ...@@ -752,9 +752,13 @@ void Core::fullscreen( bool _state ) {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void Core::showLogger(bool _state) { void Core::loggerState(int _state) {
if ( OpenFlipper::Options::gui() ) OpenFlipper::Options::LoggerState state = static_cast<OpenFlipper::Options::LoggerState> (_state);
coreWidget_->showLogger( _state ); if ( OpenFlipper::Options::gui() &&
(state == OpenFlipper::Options::Hidden ||
state == OpenFlipper::Options::InScene ||
state == OpenFlipper::Options::Normal))
coreWidget_->showLogger(state);
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
...@@ -1070,7 +1074,7 @@ void Core::setDescriptions(){ ...@@ -1070,7 +1074,7 @@ void Core::setDescriptions(){
emit setSlotDescription("fullscreen(bool)", "Enable or disable fullscreen mode", emit setSlotDescription("fullscreen(bool)", "Enable or disable fullscreen mode",
QStringList("enabled") , QStringList("enabled") ,
QStringList("Enable or disable fullscreen mode")); QStringList("Enable or disable fullscreen mode"));
emit setSlotDescription("showLogger(bool)", "Show or hide logger window", QStringList("Show or hide logger window"), QStringList()); emit setSlotDescription("loggerState(int)", "Change the logger window state", QStringList("Change the logger window state"), QStringList());
emit setSlotDescription("showToolbox(bool)", "Show or hide toolbox", QStringList("Show or hide the toolbox"), QStringList()); emit setSlotDescription("showToolbox(bool)", "Show or hide toolbox", QStringList("Show or hide the toolbox"), QStringList());
emit setSlotDescription("multiViewMode(int)", "Switch MultiView Mode", emit setSlotDescription("multiViewMode(int)", "Switch MultiView Mode",
QStringList("Mode"), QStringList("0: One Viewer\n 1: Grid \n 2: Horizontal split")); QStringList("Mode"), QStringList("0: One Viewer\n 1: Grid \n 2: Horizontal split"));
......
...@@ -273,8 +273,8 @@ public slots: ...@@ -273,8 +273,8 @@ public slots:
/// set fullscreen mode /// set fullscreen mode
void fullscreen( bool _state ); void fullscreen( bool _state );
/// Hide or show logging window /// Change the logging window state
void showLogger(bool _state); void loggerState(int _state);
/// Show or hide toolbox /// Show or hide toolbox
void showToolbox( bool _state ); void showToolbox( bool _state );
......
...@@ -164,9 +164,9 @@ void Core::readApplicationOptions(INIFile& _ini) { ...@@ -164,9 +164,9 @@ void Core::readApplicationOptions(INIFile& _ini) {
//============================================================================ //============================================================================
// Load the setting for the loger window // Load the setting for the loger window
//============================================================================ //============================================================================
bool hideLogger = false; int loggerState = 0;
if ( _ini.get_entry( hideLogger, "Options" , "HideLogger") ) if ( _ini.get_entry( loggerState, "Options" , "LoggerState") )
OpenFlipper::Options::hideLogger(hideLogger); OpenFlipper::Options::loggerState(static_cast<OpenFlipper::Options::LoggerState> (loggerState));
//============================================================================ //============================================================================
// Load the setting for the toolbox window // Load the setting for the toolbox window
...@@ -470,7 +470,7 @@ void Core::writeApplicationOptions(INIFile& _ini) { ...@@ -470,7 +470,7 @@ void Core::writeApplicationOptions(INIFile& _ini) {
draw_modes = drawModeToList( OpenFlipper::Options::standardDrawMode() ); draw_modes = drawModeToList( OpenFlipper::Options::standardDrawMode() );
_ini.add_entry("Options","StandardDrawModes",draw_modes); _ini.add_entry("Options","StandardDrawModes",draw_modes);
_ini.add_entry("Options","HideLogger", OpenFlipper::Options::hideLogger() ); _ini.add_entry("Options","LoggerState", OpenFlipper::Options::loggerState() );
_ini.add_entry("Options","HideToolbox", OpenFlipper::Options::hideToolbox() ); _ini.add_entry("Options","HideToolbox", OpenFlipper::Options::hideToolbox() );
// check if we are in fullscreen mode: // check if we are in fullscreen mode:
......
...@@ -69,7 +69,7 @@ void Core::applyOptions(){ ...@@ -69,7 +69,7 @@ void Core::applyOptions(){
coreWidget_->setWindowState( (coreWidget_->windowState() | Qt::WindowFullScreen) ^ Qt::WindowFullScreen); coreWidget_->setWindowState( (coreWidget_->windowState() | Qt::WindowFullScreen) ^ Qt::WindowFullScreen);
// Logger // Logger
coreWidget_->showLogger( !OpenFlipper::Options::hideLogger() ); coreWidget_->showLogger( OpenFlipper::Options::loggerState() );
// Prepare Picking Debugger Flag // Prepare Picking Debugger Flag
ACG::SceneGraph::PickTarget target; ACG::SceneGraph::PickTarget target;
......
...@@ -234,7 +234,7 @@ bool parseCommandLineOptions(CSimpleOpt& args){ ...@@ -234,7 +234,7 @@ bool parseCommandLineOptions(CSimpleOpt& args){
OpenFlipper::Options::hideToolbox(true); OpenFlipper::Options::hideToolbox(true);
break; break;
case OPT_HIDDDEN_LOGGER: case OPT_HIDDDEN_LOGGER:
OpenFlipper::Options::hideLogger(true); OpenFlipper::Options::loggerState(OpenFlipper::Options::Hidden);
break; break;
case OPT_FULLSCREEN: case OPT_FULLSCREEN:
OpenFlipper::Options::fullScreen(true); OpenFlipper::Options::fullScreen(true);
......
This diff is collapsed.
...@@ -119,7 +119,7 @@ static bool drawModesInContextMenu_ = true; ...@@ -119,7 +119,7 @@ static bool drawModesInContextMenu_ = true;
static bool hideToolbox_ = false; static bool hideToolbox_ = false;
/// Store the logger gui Mode mode /// Store the logger gui Mode mode
static bool hideLogger_ = false; static LoggerState loggerState_ = InScene;
/// Store if we should go into multiview Mode /// Store if we should go into multiview Mode
static bool multiView_ = true; static bool multiView_ = true;
...@@ -501,14 +501,14 @@ unsigned int examinerWidgets() { ...@@ -501,14 +501,14 @@ unsigned int examinerWidgets() {
} }
/// Set if we start the logging widget closed /// Set to current
void hideLogger( bool _hide) { void loggerState( LoggerState _state) {
hideLogger_ = _hide; loggerState_ = _state;
} }
/// Start the logging widget closed? /// Current state of the logging window?
bool hideLogger( ) { LoggerState loggerState( ) {
return hideLogger_; return loggerState_;
} }
/// Set if we start the toolbox widget closed /// Set if we start the toolbox widget closed
......
...@@ -400,13 +400,20 @@ void fontsDir(QDir _dir); ...@@ -400,13 +400,20 @@ void fontsDir(QDir _dir);
DLLEXPORT DLLEXPORT
unsigned int examinerWidgets(); unsigned int examinerWidgets();
/// Set if we start the logging widget closed /// State of the logging widget
enum LoggerState {
InScene,
Normal,
Hidden
};
/// Set the logging widget state
DLLEXPORT DLLEXPORT
void hideLogger( bool _hide); void loggerState( LoggerState _state);
/// Start the logging widget closed? /// What is the current state of the logging widget?
DLLEXPORT DLLEXPORT
bool hideLogger( ); LoggerState loggerState( );
/// Set if we start the toolbox widget closed /// Set if we start the toolbox widget closed
DLLEXPORT DLLEXPORT
......
...@@ -154,14 +154,28 @@ CoreWidget( QVector<ViewMode*>& _viewModes, ...@@ -154,14 +154,28 @@ CoreWidget( QVector<ViewMode*>& _viewModes,
logWidget_->setLineWrapMode( QTextEdit::NoWrap ); logWidget_->setLineWrapMode( QTextEdit::NoWrap );
originalLoggerSize_ = 0; originalLoggerSize_ = 0;
loggerState_ = OpenFlipper::Options::Normal;
QList<int> wsizes( splitter_->sizes() ); QList<int> wsizes( splitter_->sizes() );
if (OpenFlipper::Options::hideLogger()) {
if (OpenFlipper::Options::loggerState() == OpenFlipper::Options::InScene) {
slidingLogger_->attachWidget (logWidget_); slidingLogger_->attachWidget (logWidget_);
splitter_->insertWidget (1, tempLogWidget); splitter_->insertWidget (1, tempLogWidget);
wsizes[0] = 1; wsizes[0] = 1;
wsizes[1] = 0; wsizes[1] = 0;
splitter_->setSizes(wsizes); splitter_->setSizes(wsizes);
loggerState_ = OpenFlipper::Options::InScene;
} else if (OpenFlipper::Options::loggerState() == OpenFlipper::Options::Hidden) {
splitter_->insertWidget (1, tempLogWidget);
wsizes[0] = 1;
wsizes[1] = 0;
splitter_->setSizes(wsizes);
loggerState_ = OpenFlipper::Options::Hidden;
} else {
// Set initial values to have a usable state
wsizes[0] = 480;
wsizes[1] = 240;
splitter_->setSizes(wsizes);
} }
// ====================================================================== // ======================================================================
...@@ -511,18 +525,95 @@ CoreWidget::setFullscreen(bool _state ) { ...@@ -511,18 +525,95 @@ CoreWidget::setFullscreen(bool _state ) {
*/ */
void void
CoreWidget::toggleLogger() { CoreWidget::toggleLogger() {
// toggle
OpenFlipper::Options::hideLogger( !OpenFlipper::Options::hideLogger() ); switch (OpenFlipper::Options::loggerState ())
{
case OpenFlipper::Options::InScene:
OpenFlipper::Options::loggerState(OpenFlipper::Options::Normal);
break;
case OpenFlipper::Options::Normal:
OpenFlipper::Options::loggerState(OpenFlipper::Options::Hidden);
break;
case OpenFlipper::Options::Hidden:
OpenFlipper::Options::loggerState(OpenFlipper::Options::InScene);
break;
}
// Hide/Show Logger // Hide/Show Logger
showLogger( !OpenFlipper::Options::hideLogger() ); showLogger( OpenFlipper::Options::loggerState() );
} }
/** Hide or show logger /** Hide or show logger
*/ */
void void
CoreWidget::showLogger(bool _state) { CoreWidget::showLogger(OpenFlipper::Options::LoggerState _state) {
//Hide Logger //Hide Logger
if (_state == loggerState_)
return;
switch (_state)
{
case OpenFlipper::Options::InScene:
{
QList<int> wsizes( splitter_->sizes() );
// Remember old size
if (loggerState_ == OpenFlipper::Options::Normal)
originalLoggerSize_ = wsizes[1];
if ( originalLoggerSize_ == 0)
originalLoggerSize_ = 240;
splitter_->insertWidget (1, tempLogWidget);
wsizes[0] = wsizes[0]+wsizes[1];
wsizes[1] = 0;
splitter_->setSizes(wsizes);
logWidget_->resize (logWidget_->width (), originalLoggerSize_);
slidingLogger_->attachWidget (logWidget_);
}
break;
case OpenFlipper::Options::Normal:
{
if ( originalLoggerSize_ == 0)
originalLoggerSize_ = 240;
QList<int> wsizes( splitter_->sizes() );
if (loggerState_ == OpenFlipper::Options::InScene)
originalLoggerSize_ = logWidget_->height ();
slidingLogger_->detachWidget ();
splitter_->insertWidget (1, logWidget_);
wsizes[0] = wsizes[0]+wsizes[1] - originalLoggerSize_;
wsizes[1] = originalLoggerSize_;
splitter_->setSizes(wsizes);
}
break;
case OpenFlipper::Options::Hidden:
{
QList<int> wsizes( splitter_->sizes() );
// Remember old size
if (loggerState_ == OpenFlipper::Options::Normal)
originalLoggerSize_ = wsizes[1];
if (loggerState_ == OpenFlipper::Options::InScene)
{
slidingLogger_->detachWidget ();
originalLoggerSize_ = logWidget_->height ();
}
splitter_->insertWidget (1, tempLogWidget);
wsizes[0] = wsizes[0]+wsizes[1];
wsizes[1] = 0;
splitter_->setSizes(wsizes);
}
break;
}
loggerState_ = _state;
/*
if ( !_state ) { if ( !_state ) {
QList<int> wsizes( splitter_->sizes() ); QList<int> wsizes( splitter_->sizes() );
...@@ -563,20 +654,8 @@ CoreWidget::showLogger(bool _state) { ...@@ -563,20 +654,8 @@ CoreWidget::showLogger(bool _state) {
wsizes[0] = wsizes[0]+wsizes[1] - height; wsizes[0] = wsizes[0]+wsizes[1] - height;
wsizes[1] = height; wsizes[1] = height;
splitter_->setSizes(wsizes); splitter_->setSizes(wsizes);
/*
if ( originalLoggerSize_ == 0)
originalLoggerSize_ = 240;
QList<int> wsizes( splitter_->sizes() );
if (wsizes[0] == 0)
wsizes[0] = height();
wsizes[0] = wsizes[0]+wsizes[1] - originalLoggerSize_;
wsizes[1] = originalLoggerSize_;
splitter_->setSizes(wsizes);
*/
} }
*/
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
......
...@@ -49,6 +49,7 @@ ...@@ -49,6 +49,7 @@
//== INCLUDES ================================================================= //== INCLUDES =================================================================
#include "OpenFlipper/common/Types.hh" #include "OpenFlipper/common/Types.hh"
#include <OpenFlipper/common/GlobalOptions.hh>
#include <OpenFlipper/BasePlugin/ContextMenuInterface.hh> #include <OpenFlipper/BasePlugin/ContextMenuInterface.hh>
#include <OpenFlipper/BasePlugin/LoggingInterface.hh> #include <OpenFlipper/BasePlugin/LoggingInterface.hh>
#include <OpenFlipper/BasePlugin/MenuInterface.hh> #include <OpenFlipper/BasePlugin/MenuInterface.hh>
...@@ -82,6 +83,7 @@ ...@@ -82,6 +83,7 @@
#include <OpenFlipper/INIFile/INIFile.hh> #include <OpenFlipper/INIFile/INIFile.hh>
struct ViewMode{ struct ViewMode{
QString name; QString name;
bool custom; //is the mode defined by the user? bool custom; //is the mode defined by the user?
...@@ -291,7 +293,7 @@ public: ...@@ -291,7 +293,7 @@ public:
void toggleLogger(); void toggleLogger();
/// Change visibility of the logger /// Change visibility of the logger
void showLogger(bool _state); void showLogger(OpenFlipper::Options::LoggerState _state);
/// Hide or show toolbox area /// Hide or show toolbox area
void toggleToolbox(); void toggleToolbox();
...@@ -299,6 +301,9 @@ public: ...@@ -299,6 +301,9 @@ public:
/// Show or hide toolbox /// Show or hide toolbox
void showToolbox( bool _state ); void showToolbox( bool _state );
private:
OpenFlipper::Options::LoggerState loggerState_;
/** @} */ /** @} */
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
#define BACKGROUND_BLUE 0xff #define BACKGROUND_BLUE 0xff
#define BACKGROUND_ALPHA 0xcf #define BACKGROUND_ALPHA 0xcf
#define SLIDE_DURATION 500 #define SLIDE_DURATION 1000
//== INCLUDES ================================================================= //== INCLUDES =================================================================
...@@ -100,8 +100,10 @@ QtSlideWindow::QtSlideWindow(QString _name, QGraphicsItem *_parent) : ...@@ -100,8 +100,10 @@ QtSlideWindow::QtSlideWindow(QString _name, QGraphicsItem *_parent) :
hideAnimation_->setItem (this); hideAnimation_->setItem (this);
hideAnimation_->setTimeLine (hideTimeLine_); hideAnimation_->setTimeLine (hideTimeLine_);
hideAnimation_->setTranslationAt (0.0, 0, geometry ().height ());
for (int i = 0; i < geometry ().height (); ++i) for (int i = 0; i < geometry ().height (); ++i)
hideAnimation_->setTranslationAt (i / geometry ().height (), 0, geometry ().height () - i); hideAnimation_->setTranslationAt (0.25 + (i / (geometry ().height () * 2.0)), 0, geometry ().height () - i);
hideAnimation_->setTranslationAt (1.0, 0, 0);
hide (); hide ();
} }
...@@ -234,8 +236,10 @@ void QtSlideWindow::resizeEvent (QGraphicsSceneResizeEvent *_event) ...@@ -234,8 +236,10 @@ void QtSlideWindow::resizeEvent (QGraphicsSceneResizeEvent *_event)
if (hideAnimation_) if (hideAnimation_)
{ {
hideAnimation_->clear (); hideAnimation_->clear ();
hideAnimation_->setTranslationAt (0.0, 0, geometry ().height ());
for (int i = 0; i < geometry ().height (); ++i) for (int i = 0; i < geometry ().height (); ++i)
hideAnimation_->setTranslationAt (i / geometry ().height (), 0, geometry ().height () - i); hideAnimation_->setTranslationAt (0.25 + (i / (geometry ().height () * 2.0)), 0, geometry ().height () - i);
hideAnimation_->setTranslationAt (1.0, 0, 0);
} }
} }
...@@ -247,8 +251,10 @@ void QtSlideWindow::moveEvent (QGraphicsSceneMoveEvent *_event) ...@@ -247,8 +251,10 @@ void QtSlideWindow::moveEvent (QGraphicsSceneMoveEvent *_event)
if (hideAnimation_) if (hideAnimation_)
{ {
hideAnimation_->clear (); hideAnimation_->clear ();
hideAnimation_->setTranslationAt (0.0, 0, geometry ().height ());
for (int i = 0; i < geometry ().height (); ++i) for (int i = 0; i < geometry ().height (); ++i)
hideAnimation_->setTranslationAt (i / geometry ().height (), 0, geometry ().height () - i); hideAnimation_->setTranslationAt (0.25 + (i / (geometry ().height () * 2.0)), 0, geometry ().height () - i);
hideAnimation_->setTranslationAt (1.0, 0, 0);
} }
} }
......
...@@ -127,7 +127,8 @@ void OptionsWidget::showEvent ( QShowEvent * /*event*/ ) { ...@@ -127,7 +127,8 @@ void OptionsWidget::showEvent ( QShowEvent * /*event*/ ) {
fullscreen->setChecked( OpenFlipper::Options::fullScreen() ); fullscreen->setChecked( OpenFlipper::Options::fullScreen() );
splash->setChecked( OpenFlipper::Options::splash() ); splash->setChecked( OpenFlipper::Options::splash() );
toolbox->setChecked( !OpenFlipper::Options::hideToolbox() ); toolbox->setChecked( !OpenFlipper::Options::hideToolbox() );
logger->setChecked( !OpenFlipper::Options::hideLogger() ); #warning FIXME
logger->setChecked( OpenFlipper::Options::loggerState() != OpenFlipper::Options::Hidden);
enableLogFile->setChecked( OpenFlipper::Options::logFileEnabled() ); enableLogFile->setChecked( OpenFlipper::Options::logFileEnabled() );
//paths //paths
...@@ -359,7 +360,10 @@ void OptionsWidget::slotApply() { ...@@ -359,7 +360,10 @@ void OptionsWidget::slotApply() {
OpenFlipper::Options::fullScreen( fullscreen->isChecked() ); OpenFlipper::Options::fullScreen( fullscreen->isChecked() );
OpenFlipper::Options::splash( splash->isChecked() ); OpenFlipper::Options::splash( splash->isChecked() );
OpenFlipper::Options::hideToolbox( !toolbox->isChecked() ); OpenFlipper::Options::hideToolbox( !toolbox->isChecked() );
OpenFlipper::Options::hideLogger( !logger->isChecked() ); if (logger->isChecked())
OpenFlipper::Options::loggerState( OpenFlipper::Options::Normal );
else
OpenFlipper::Options::loggerState( OpenFlipper::Options::Hidden );
OpenFlipper::Options::logFileEnabled( enableLogFile->isChecked() ); OpenFlipper::Options::logFileEnabled( enableLogFile->isChecked() );
//paths //paths
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment