~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to kstyles/oxygen/demo/oxygentabdemowidget.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//////////////////////////////////////////////////////////////////////////////
 
2
// oxygentabdemowidget.cpp
 
3
// oxygen tabwidget demo widget
 
4
// -------------------
 
5
//
 
6
// Copyright (c) 2010 Hugo Pereira Da Costa <hugo@oxygen-icons.org>
 
7
//
 
8
// Permission is hereby granted, free of charge, to any person obtaining a copy
 
9
// of this software and associated documentation files (the "Software"), to
 
10
// deal in the Software without restriction, including without limitation the
 
11
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 
12
// sell copies of the Software, and to permit persons to whom the Software is
 
13
// furnished to do so, subject to the following conditions:
 
14
//
 
15
// The above copyright notice and this permission notice shall be included in
 
16
// all copies or substantial portions of the Software.
 
17
//
 
18
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
19
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
20
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 
21
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 
22
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 
23
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 
24
// IN THE SOFTWARE.
 
25
//////////////////////////////////////////////////////////////////////////////
 
26
 
 
27
#include "oxygentabdemowidget.h"
 
28
#include "oxygentabdemowidget.moc"
 
29
#include "oxygentabwidget.moc"
 
30
 
 
31
#include <QtGui/QToolButton>
 
32
#include <KIcon>
 
33
 
 
34
namespace Oxygen
 
35
{
 
36
 
 
37
    //______________________________________________________________
 
38
    TabDemoWidget::TabDemoWidget( QWidget* parent ):
 
39
        DemoWidget( parent ),
 
40
        _left( new QToolButton(0) ),
 
41
        _right( new QToolButton(0) )
 
42
    {
 
43
        ui.setupUi( this );
 
44
        connect( ui.tabPositionComboBox, SIGNAL( currentIndexChanged( int ) ), SLOT( changeTabPosition( int ) ) );
 
45
        connect( ui.textPositionComboBox, SIGNAL( currentIndexChanged( int ) ), SLOT( changeTextPosition( int ) ) );
 
46
        connect( ui.documentModeCheckBox, SIGNAL( toggled( bool ) ), SLOT( toggleDocumentMode( bool ) ) );
 
47
        connect( ui.cornerWidgetsCheckBox, SIGNAL( toggled( bool ) ), SLOT( toggleCornerWidgets( bool ) ) );
 
48
        connect( ui.tabBarVisibilityCheckBox, SIGNAL( toggled( bool ) ), ui.tabWidget, SLOT( toggleTabBarVisibility( bool ) ) );
 
49
        ui.textPositionComboBox->setCurrentIndex( 1 );
 
50
 
 
51
        _left->setIcon( KIcon( "tab-new" ) );
 
52
        _left->setVisible( false );
 
53
 
 
54
        _right->setIcon( KIcon( "tab-close" ) );
 
55
        _right->setVisible( false );
 
56
 
 
57
    }
 
58
 
 
59
    //______________________________________________________________
 
60
    void TabDemoWidget::benchmark( void )
 
61
    {
 
62
        if( !isVisible() ) return;
 
63
 
 
64
        if( true )
 
65
        {
 
66
            simulator().selectComboBoxItem( ui.tabPositionComboBox, 1 );
 
67
            simulator().selectComboBoxItem( ui.tabPositionComboBox, 2 );
 
68
            simulator().selectComboBoxItem( ui.tabPositionComboBox, 3 );
 
69
            simulator().selectComboBoxItem( ui.tabPositionComboBox, 0 );
 
70
 
 
71
            simulator().selectComboBoxItem( ui.textPositionComboBox, 0 );
 
72
            simulator().selectComboBoxItem( ui.textPositionComboBox, 2 );
 
73
            simulator().selectComboBoxItem( ui.textPositionComboBox, 1 );
 
74
        }
 
75
 
 
76
        if( true )
 
77
        {
 
78
 
 
79
            simulator().click( ui.documentModeCheckBox );
 
80
            simulator().click( ui.documentModeCheckBox );
 
81
 
 
82
            simulator().click( ui.cornerWidgetsCheckBox );
 
83
            simulator().click( ui.cornerWidgetsCheckBox );
 
84
 
 
85
            simulator().click( ui.tabBarVisibilityCheckBox );
 
86
            simulator().click( ui.tabBarVisibilityCheckBox );
 
87
        }
 
88
 
 
89
        if( true )
 
90
        {
 
91
            simulator().selectTab( ui.tabWidget, 1 );
 
92
            simulator().selectTab( ui.tabWidget, 2 );
 
93
            simulator().selectTab( ui.tabWidget, 3 );
 
94
            simulator().selectTab( ui.tabWidget, 0 );
 
95
        }
 
96
 
 
97
        // run
 
98
        simulator().run();
 
99
 
 
100
    }
 
101
 
 
102
}