CoreWidgetToolbar.cc 2.95 KB
Newer Older
Jan Möbius's avatar
 
Jan Möbius committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14
//=============================================================================
//
//                               OpenFlipper
//        Copyright (C) 2008 by Computer Graphics Group, RWTH Aachen
//                           www.openflipper.org
//
//-----------------------------------------------------------------------------
//
//                                License
//
//  OpenFlipper is free software: you can redistribute it and/or modify
//  it under the terms of the GNU Lesser General Public License as published by
//  the Free Software Foundation, either version 3 of the License, or
//  (at your option) any later version.
Jan Möbius's avatar
Jan Möbius committed
15
//
Jan Möbius's avatar
 
Jan Möbius committed
16 17 18 19
//  OpenFlipper is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU Lesser General Public License for more details.
Jan Möbius's avatar
Jan Möbius committed
20
//
Jan Möbius's avatar
 
Jan Möbius committed
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
//  You should have received a copy of the GNU Lesser General Public License
//  along with OpenFlipper.  If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
//
//   $Revision: 1727 $
//   $Author: moebius $
//   $Date: 2008-05-10 00:35:25 +0200 (Sat, 10 May 2008) $
//
//=============================================================================




//=============================================================================
//
//  CLASS MViewWidget - IMPLEMENTATION
//
//=============================================================================


//== INCLUDES =================================================================

// -------------------- mview
#include "CoreWidget.hh"
// -------------------- ACG
#include "OpenFlipper/common/GlobalOptions.hh"

// -------------------- Qt

Jan Möbius's avatar
Jan Möbius committed
51
//== IMPLEMENTATION ==========================================================
Jan Möbius's avatar
 
Jan Möbius committed
52 53

void CoreWidget::slotAddToolbar(QToolBar* _toolbar) {
Jan Möbius's avatar
Jan Möbius committed
54 55 56

  for ( uint i = 0 ; i < toolbars_.size(); ++i ) {
    if ( toolbars_[i]->windowTitle() == _toolbar->windowTitle() ) {
57
      emit log(LOGERR,"slotAddToolbar: Toolbar already added to system: " + _toolbar->windowTitle() );
Jan Möbius's avatar
Jan Möbius committed
58 59 60
      return;
    }
  }
61

Jan Möbius's avatar
Jan Möbius committed
62 63
  _toolbar->setObjectName( _toolbar->windowTitle() );
  toolbars_.push_back( _toolbar );
Jan Möbius's avatar
 
Jan Möbius committed
64
  addToolBar( _toolbar );
Jan Möbius's avatar
Jan Möbius committed
65 66 67 68 69
}

void CoreWidget::getToolBar( QString _name, QToolBar*& _toolbar) {

  for ( uint i = 0 ; i < toolbars_.size(); ++i ) {
70

Jan Möbius's avatar
Jan Möbius committed
71 72 73 74
    if ( toolbars_[i]->windowTitle() == _name ) {
      _toolbar = toolbars_[i];
      return;
    }
75

Jan Möbius's avatar
Jan Möbius committed
76 77 78
  }

  _toolbar = 0;
79 80

  emit log(LOGERR,"getToolBar: Toolbar not found." );
Jan Möbius's avatar
 
Jan Möbius committed
81 82 83
}

void CoreWidget::slotRemoveToolbar(QToolBar* _toolbar) {
Jan Möbius's avatar
Jan Möbius committed
84
  for ( uint i = 0 ; i < toolbars_.size(); ++i ) {
85

Jan Möbius's avatar
Jan Möbius committed
86 87 88 89 90
    if ( toolbars_[i]->windowTitle() == _toolbar->windowTitle() ) {
      std::cerr << "Todo : erase Toolbar from list" << std::endl;
      removeToolBar( _toolbar );
      return;
    }
91

Jan Möbius's avatar
Jan Möbius committed
92 93 94
  }

  emit log(LOGERR,"Remove Toolbar: Toolbar not found." );
Jan Möbius's avatar
 
Jan Möbius committed
95 96 97 98
}


//=============================================================================