~ubuntu-branches/ubuntu/oneiric/valkyrie/oneiric

« back to all changes in this revision

Viewing changes to valkyrie/tool_views/tool_view.cpp

  • Committer: Package Import Robot
  • Author(s): Clint Byrum
  • Date: 2011-09-02 22:08:34 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: package-import@ubuntu.com-20110902220834-kigsixteppj9epp5
Tags: 2.0.0-0ubuntu1
* New upstream release. (LP: #635129, LP: #832886, LP: #721298)
* Standards bumped to 3.9.2, no changes required.
* d/control, d/rules: cdbs removed, dh minimal rule instead.
* d/control: build system is qmake not autotools
* d/control: bump required qt to qt4
* d/valkyrie.install: installing html docs manually as make install
  no longer does so.
* d/patches/valkyrie-2.0.0-fix-doc.dir.patch: Fix doc path to match
  policy. Also corrects LP: #588074 since the documentation link now
  works.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* ---------------------------------------------------------------------
2
 
 * Implementation of class ToolView                        tool_view.cpp
3
 
 * Base class for all tool views
4
 
 * ---------------------------------------------------------------------
5
 
 * This file is part of Valkyrie, a front-end for Valgrind
6
 
 * Copyright (C) 2000-2008, OpenWorks LLP <info@open-works.co.uk>
7
 
 * This program is released under the terms of the GNU GPL v.2
8
 
 * See the file COPYING for the full license details.
9
 
 */
10
 
 
11
 
#include "tool_view.h"
12
 
#include "vk_utils.h"
13
 
#include "vk_config.h"
14
 
 
15
 
#include <qlayout.h>
16
 
 
17
 
 
18
 
ToolView::~ToolView() { }
19
 
 
20
 
ToolView::ToolView( QWidget* parent, const char* name )
21
 
   : QMainWindow( parent, name, WDestructiveClose )
22
 
{
23
 
   QString caption = QString(name);
24
 
   if (caption.length() > 0)
25
 
      caption[0] = caption[0].upper();
26
 
   setCaption( caption );
27
 
 
28
 
   central = new QWidget( this );
29
 
   setCentralWidget( central );
30
 
 
31
 
   setToolFont( vkConfig->rdFont( "font-tool-user", "valkyrie" ) );
32
 
}
33
 
 
34
 
void ToolView::setToolFont( QFont font )
35
 
{
36
 
   font.setStyleHint( QFont::TypeWriter );
37
 
   central->setFont( font );
38
 
}
39
 
 
40
 
 
41
 
 
42
 
 
43
 
/* Stack of ToolViews */
44
 
 
45
 
ToolViewStack::~ToolViewStack() { }
46
 
 
47
 
ToolViewStack::ToolViewStack( QWidget* parent/*=0*/, const char * name/*=0*/ )
48
 
   : QWidgetStack( parent, name ) { }
49
 
 
50
 
ToolViewStack::ToolViewStack( QWidget* parent, const char * name, WFlags f )
51
 
   : QWidgetStack( parent, name, f ) { }
52
 
 
53
 
int ToolViewStack::addView( ToolView* tv, int id )
54
 
{ return addWidget(tv, id); }
55
 
 
56
 
void ToolViewStack::removeView( QWidget* w )
57
 
{ removeWidget( w ); }
58
 
 
59
 
ToolView* ToolViewStack::view( int id ) const
60
 
{ return (ToolView*)widget(id); }
61
 
 
62
 
 
63
 
/* returns a list of ToolViews */
64
 
const ToolViewList* ToolViewStack::viewList()
65
 
{ return (ToolViewList*)queryList( "ToolView", 0, false, false); } 
66
 
 
67
 
/* iterate over the views to find one != lastView
68
 
   returns 0 if none found */
69
 
ToolView* ToolViewStack::ToolViewStack::nextView( ToolView* lastView/*=0*/ )
70
 
{
71
 
   const ToolViewList* views = viewList();
72
 
   ToolViewListIter it( *views );
73
 
   ToolView* view;
74
 
   for (; ((view = it.current()) != 0); ++it ) {
75
 
      if (view != lastView)
76
 
         return view;
77
 
   }
78
 
   return 0;
79
 
}
80
 
 
81
 
/* return currently-visible view 
82
 
   0 if no visible */
83
 
ToolView* ToolViewStack::visible()
84
 
{ return (ToolView*)QWidgetStack::visibleWidget(); }
85
 
 
86
 
/* return id of currently-visible view
87
 
   -1 if no visible */
88
 
int ToolViewStack::visibleId()
89
 
{ return id( visible() ); }
90
 
 
91
 
void ToolViewStack::listViews()
92
 
{
93
 
   vkPrint("=============");
94
 
   const ToolViewList* views = viewList();
95
 
   ToolViewListIter it( *views ); // iterate over the views
96
 
   ToolView* view;
97
 
   for (; ((view = it.current()) != 0); ++it ) {
98
 
      vkPrint("ToolView: id(%d), name(%s)", id(view), view->name());
99
 
   }
100
 
}
101
 
 
102
 
 
103
 
/* Bring new ToolView to front
104
 
   - Hide any previous ToolView widgets
105
 
   - Raise new ToolView
106
 
   - Show any current ToolView widgets */
107
 
void ToolViewStack::raiseView( int id )
108
 
{ raiseWidget(id); }
109
 
 
110
 
/* Ditto */
111
 
void ToolViewStack::raiseView( ToolView* tv )
112
 
{ raiseWidget(tv); }