summaryrefslogtreecommitdiff
path: root/libopie/otabwidget.cpp
authorharlekin <harlekin>2002-08-21 22:28:56 (UTC)
committer harlekin <harlekin>2002-08-21 22:28:56 (UTC)
commit0dc65f8d04c392448731bc11a4b66f26ac9c5bc4 (patch) (unidiff)
tree2216499e2c3d8d7bc66dec755ec7d9cc1a3d6c43 /libopie/otabwidget.cpp
parent104db9a1858142972d2f41442e5416ab5d304da9 (diff)
downloadopie-0dc65f8d04c392448731bc11a4b66f26ac9c5bc4.zip
opie-0dc65f8d04c392448731bc11a4b66f26ac9c5bc4.tar.gz
opie-0dc65f8d04c392448731bc11a4b66f26ac9c5bc4.tar.bz2
the right license also in the header
Diffstat (limited to 'libopie/otabwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/otabwidget.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/libopie/otabwidget.cpp b/libopie/otabwidget.cpp
index 6e10be9..b60d472 100644
--- a/libopie/otabwidget.cpp
+++ b/libopie/otabwidget.cpp
@@ -1,138 +1,138 @@
1/* 1/*
2� � � � � � � � This file is part of the Opie Project 2� � � � � � � � This file is part of the Opie Project
3 3
4� � � � � � � Copyright (c) 2002 Dan Williams <williamsdr@acm.org> 4� � � � � � � Copyright (c) 2002 Dan Williams <williamsdr@acm.org>
5 =. 5 =.
6 .=l. 6 .=l.
7� � � � � �.>+-= 7� � � � � �.>+-=
8�_;:, � � .> � �:=|. This program is free software; you can 8�_;:, � � .> � �:=|. This program is free software; you can
9.> <`_, � > �. � <= redistribute it and/or modify it under 9.> <`_, � > �. � <= redistribute it and/or modify it under
10:`=1 )Y*s>-.-- � : the terms of the GNU General Public 10:`=1 )Y*s>-.-- � : the terms of the GNU Library General Public
11.="- .-=="i, � � .._ License as published by the Free Software 11.="- .-=="i, � � .._ License as published by the Free Software
12�- . � .-<_> � � .<> Foundation; either version 2 of the License, 12�- . � .-<_> � � .<> Foundation; either version 2 of the License,
13� � �._= =} � � � : or (at your option) any later version. 13� � �._= =} � � � : or (at your option) any later version.
14� � .%`+i> � � � _;_. 14� � .%`+i> � � � _;_.
15� � .i_,=:_. � � �-<s. This program is distributed in the hope that 15� � .i_,=:_. � � �-<s. This program is distributed in the hope that
16� � �+ �. �-:. � � � = it will be useful, but WITHOUT ANY WARRANTY; 16� � �+ �. �-:. � � � = it will be useful, but WITHOUT ANY WARRANTY;
17� � : .. � �.:, � � . . . without even the implied warranty of 17� � : .. � �.:, � � . . . without even the implied warranty of
18� � =_ � � � �+ � � =;=|` MERCHANTABILITY or FITNESS FOR A 18� � =_ � � � �+ � � =;=|` MERCHANTABILITY or FITNESS FOR A
19� _.=:. � � � : � �:=>`: PARTICULAR PURPOSE. See the GNU 19� _.=:. � � � : � �:=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.= � � � = � � � ; Library General Public License for more 20..}^=.= � � � = � � � ; Library General Public License for more
21++= � -. � � .` � � .: details. 21++= � -. � � .` � � .: details.
22�: � � = �...= . :.=- 22�: � � = �...= . :.=-
23�-. � .:....=;==+<; You should have received a copy of the GNU 23�-. � .:....=;==+<; You should have received a copy of the GNU
24� -_. . . � )=. �= Library General Public License along with 24� -_. . . � )=. �= Library General Public License along with
25� � -- � � � �:-=` this library; see the file COPYING.LIB. 25� � -- � � � �:-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation, 26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330, 27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
29 29
30*/ 30*/
31 31
32#include "otabwidget.h" 32#include "otabwidget.h"
33 33
34#include <qpe/config.h> 34#include <qpe/config.h>
35#include <qpe/resource.h> 35#include <qpe/resource.h>
36 36
37#include <qcombobox.h> 37#include <qcombobox.h>
38#include <qtabbar.h> 38#include <qtabbar.h>
39#include <qwidgetstack.h> 39#include <qwidgetstack.h>
40 40
41OTabWidget::OTabWidget( QWidget *parent, const char *name, TabStyle s, TabPosition p ) 41OTabWidget::OTabWidget( QWidget *parent, const char *name, TabStyle s, TabPosition p )
42 : QWidget( parent, name ) 42 : QWidget( parent, name )
43{ 43{
44 if ( s == Global ) 44 if ( s == Global )
45 { 45 {
46 Config config( "qpe" ); 46 Config config( "qpe" );
47 config.setGroup( "Appearance" ); 47 config.setGroup( "Appearance" );
48 tabBarStyle = ( TabStyle ) config.readNumEntry( "TabStyle", (int) IconTab ); 48 tabBarStyle = ( TabStyle ) config.readNumEntry( "TabStyle", (int) IconTab );
49 if ( tabBarStyle <= Global || tabBarStyle > IconList) 49 if ( tabBarStyle <= Global || tabBarStyle > IconList)
50 { 50 {
51 tabBarStyle = IconTab; 51 tabBarStyle = IconTab;
52 } 52 }
53 QString pos = config.readEntry( "TabPosition", "Top"); 53 QString pos = config.readEntry( "TabPosition", "Top");
54 if ( pos == "Bottom" ) 54 if ( pos == "Bottom" )
55 { 55 {
56 tabBarPosition = Bottom; 56 tabBarPosition = Bottom;
57 } 57 }
58 else 58 else
59 { 59 {
60 tabBarPosition = Top; 60 tabBarPosition = Top;
61 } 61 }
62 } 62 }
63 else 63 else
64 { 64 {
65 tabBarStyle = s; 65 tabBarStyle = s;
66 tabBarPosition = p; 66 tabBarPosition = p;
67 } 67 }
68 68
69 widgetStack = new QWidgetStack( this, "widgetstack" ); 69 widgetStack = new QWidgetStack( this, "widgetstack" );
70 widgetStack->setFrameStyle( QFrame::StyledPanel | QFrame::Raised ); 70 widgetStack->setFrameStyle( QFrame::StyledPanel | QFrame::Raised );
71 widgetStack->setLineWidth( style().defaultFrameWidth() ); 71 widgetStack->setLineWidth( style().defaultFrameWidth() );
72 72
73 tabBarStack = new QWidgetStack( this, "tabbarstack" ); 73 tabBarStack = new QWidgetStack( this, "tabbarstack" );
74 74
75 tabBar = new QTabBar( tabBarStack, "tabbar" ); 75 tabBar = new QTabBar( tabBarStack, "tabbar" );
76 tabBarStack->addWidget( tabBar, 0 ); 76 tabBarStack->addWidget( tabBar, 0 );
77 connect( tabBar, SIGNAL( selected( int ) ), this, SLOT( slotTabBarSelected( int ) ) ); 77 connect( tabBar, SIGNAL( selected( int ) ), this, SLOT( slotTabBarSelected( int ) ) );
78 78
79 tabList = new QComboBox( false, tabBarStack, "tablist" ); 79 tabList = new QComboBox( false, tabBarStack, "tablist" );
80 tabBarStack->addWidget( tabList, 1 ); 80 tabBarStack->addWidget( tabList, 1 );
81 connect( tabList, SIGNAL( activated( int ) ), this, SLOT( slotTabListSelected( int ) ) ); 81 connect( tabList, SIGNAL( activated( int ) ), this, SLOT( slotTabListSelected( int ) ) );
82 82
83 if ( tabBarStyle == TextTab || tabBarStyle == IconTab ) 83 if ( tabBarStyle == TextTab || tabBarStyle == IconTab )
84 { 84 {
85 tabBarStack->raiseWidget( tabBar ); 85 tabBarStack->raiseWidget( tabBar );
86 } 86 }
87 else if ( tabBarStyle == TextList || tabBarStyle == IconList ) 87 else if ( tabBarStyle == TextList || tabBarStyle == IconList )
88 { 88 {
89 tabBarStack->raiseWidget( tabList ); 89 tabBarStack->raiseWidget( tabList );
90 } 90 }
91 91
92 if ( tabBarPosition == Bottom ) 92 if ( tabBarPosition == Bottom )
93 { 93 {
94 tabBar->setShape( QTabBar::RoundedBelow ); 94 tabBar->setShape( QTabBar::RoundedBelow );
95 } 95 }
96 96
97 currentTab= 0x0; 97 currentTab= 0x0;
98} 98}
99 99
100OTabWidget::~OTabWidget() 100OTabWidget::~OTabWidget()
101{ 101{
102} 102}
103 103
104void OTabWidget::addTab( QWidget *child, const QString &icon, const QString &label ) 104void OTabWidget::addTab( QWidget *child, const QString &icon, const QString &label )
105{ 105{
106 QPixmap iconset = loadSmooth( icon ); 106 QPixmap iconset = loadSmooth( icon );
107 107
108 QTab * tab = new QTab(); 108 QTab * tab = new QTab();
109 if ( tabBarStyle == IconTab ) 109 if ( tabBarStyle == IconTab )
110 { 110 {
111 tab->label = QString::null; 111 tab->label = QString::null;
112 } 112 }
113 else 113 else
114 { 114 {
115 tab->label = label; 115 tab->label = label;
116 } 116 }
117 if ( tabBarStyle == IconTab || tabBarStyle == IconList) 117 if ( tabBarStyle == IconTab || tabBarStyle == IconList)
118 { 118 {
119 tab->iconset = new QIconSet( iconset ); 119 tab->iconset = new QIconSet( iconset );
120 } 120 }
121 int tabid = tabBar->addTab( tab ); 121 int tabid = tabBar->addTab( tab );
122 122
123 if ( tabBarStyle == IconTab || tabBarStyle == IconList ) 123 if ( tabBarStyle == IconTab || tabBarStyle == IconList )
124 { 124 {
125 tabList->insertItem( iconset, label, -1 ); 125 tabList->insertItem( iconset, label, -1 );
126 } 126 }
127 else 127 else
128 { 128 {
129 tabList->insertItem( label ); 129 tabList->insertItem( label );
130 } 130 }
131 131
132 widgetStack->addWidget( child, tabid ); 132 widgetStack->addWidget( child, tabid );
133 widgetStack->raiseWidget( child ); 133 widgetStack->raiseWidget( child );
134 134
135 OTabInfo *tabinfo = new OTabInfo( tabid, child, icon, label ); 135 OTabInfo *tabinfo = new OTabInfo( tabid, child, icon, label );
136 tabs.append( tabinfo ); 136 tabs.append( tabinfo );
137 selectTab( tabinfo ); 137 selectTab( tabinfo );
138} 138}