~ubuntu-branches/ubuntu/trusty/kvirc/trusty-proposed

« back to all changes in this revision

Viewing changes to src/kvilib/tal/KviTalGroupBox.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Kai Wasserbäch, Kai Wasserbäch, Raúl Sánchez Siles
  • Date: 2011-02-12 10:40:21 UTC
  • mfrom: (14.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20110212104021-5mh4f75jlku20mnt
The combined "Twisted Experiment" and "Nocturnal Raid" release.

[ Kai Wasserbäch ]
* Synced to upstream's SVN revision 5467.
* debian/rules:
  - Added .PHONY line.
  - Resurrect -DMANUAL_REVISION, got lost somewhere and we build SVN
    revisions again.
  - Replace "-DWITH_NO_EMBEDDED_CODE=YES" with "-DWANT_CRYPTOPP=YES".
  - Change the remaining -DWITH/-DWITHOUT to the new -DWANT syntax.
* debian/control:
  - Removed DMUA, I'm a DD now.
  - Changed my e-mail address.
  - Removed unneeded relationships (no upgrades over two releases are
    supported).
  - Fix Suggests for kvirc-dbg.
  - kvirc-data: Make the "Suggests: kvirc" a Recommends, doesn't make much
    sense to install the -data package without the program.
* debian/source/local-options: Added with "unapply-patches".
* debian/kvirc.lintian-overrides: Updated to work for 4.1.1.
* debian/patches/21_make_shared-mime-info_B-D_superfluous.patch: Updated.
* debian/kvirc-data.install: Added .notifyrc.

[ Raúl Sánchez Siles ]
* Stating the right version where kvirc-data break and replace should happen.
* Fixing link to license file.
* Added French and Portuguese man pages.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//=============================================================================
 
2
//
 
3
//   File : KviTalGroupBox.cpp
 
4
//   Creation date : Mon Jan 22 2007 11:25:08 by Szymon Stefanek
 
5
//
 
6
//   This file is part of the KVIrc irc client distribution
 
7
//   Copyright (C) 2007-2010 Szymon Stefanek (pragma at kvirc dot net)
 
8
//
 
9
//   This program is FREE software. You can redistribute it and/or
 
10
//   modify it under the terms of the GNU General Public License
 
11
//   as published by the Free Software Foundation; either version 2
 
12
//   of the License, or (at your opinion) any later version.
 
13
//
 
14
//   This program is distributed in the HOPE that it will be USEFUL,
 
15
//   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
17
//   See the GNU General Public License for more details.
 
18
//
 
19
//   You should have received a copy of the GNU General Public License
 
20
//   along with this program. If not, write to the Free Software Foundation,
 
21
//   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
22
//
 
23
//=============================================================================
 
24
 
 
25
#include "KviTalGroupBox.h"
 
26
 
 
27
#include <QChildEvent>
 
28
#include <QGroupBox>
 
29
 
 
30
KviTalGroupBox::KviTalGroupBox(QWidget * pParent, char * pcName)
 
31
: QGroupBox(pParent)
 
32
{
 
33
        setObjectName(pcName);
 
34
        m_pLayout = new QHBoxLayout(this);
 
35
        QGroupBox::setLayout(m_pLayout);
 
36
}
 
37
 
 
38
KviTalGroupBox::KviTalGroupBox(QWidget * pParent)
 
39
: QGroupBox(pParent)
 
40
{
 
41
        m_pLayout = 0;
 
42
}
 
43
 
 
44
KviTalGroupBox::KviTalGroupBox(const QString & szTitle, QWidget * pParent)
 
45
: QGroupBox(szTitle,pParent)
 
46
{
 
47
        m_pLayout = 0;
 
48
}
 
49
 
 
50
KviTalGroupBox::KviTalGroupBox(Qt::Orientation orientation, QWidget * pParent)
 
51
: QGroupBox(pParent)
 
52
{
 
53
        if(orientation == Qt::Vertical)
 
54
                m_pLayout = new QHBoxLayout(this);
 
55
        else
 
56
                m_pLayout = new QVBoxLayout(this);
 
57
        QGroupBox::setLayout(m_pLayout);
 
58
}
 
59
 
 
60
KviTalGroupBox::KviTalGroupBox(Qt::Orientation orientation, const QString & szTitle, QWidget * pParent)
 
61
: QGroupBox(szTitle,pParent)
 
62
{
 
63
        mOrientation = orientation;
 
64
        if(orientation == Qt::Vertical)
 
65
                m_pLayout = new QHBoxLayout(this);
 
66
        else
 
67
                m_pLayout = new QVBoxLayout(this);
 
68
        QGroupBox::setLayout(m_pLayout);
 
69
}
 
70
 
 
71
KviTalGroupBox::~KviTalGroupBox()
 
72
{
 
73
}
 
74
 
 
75
void KviTalGroupBox::childEvent(QChildEvent * e)
 
76
{
 
77
        if(!e->child()->isWidgetType())
 
78
                return;
 
79
        if(e->child()->parent() != this)
 
80
                return;
 
81
        if(!m_pLayout)
 
82
                return;
 
83
        if(m_pLayout != layout())
 
84
                return;
 
85
 
 
86
        switch(e->type())
 
87
        {
 
88
                case QEvent::ChildAdded:
 
89
                        m_pLayout->addWidget((QWidget *)(e->child()));
 
90
                        break;
 
91
                case QEvent::ChildRemoved:
 
92
                        m_pLayout->removeWidget((QWidget *)(e->child()));
 
93
                        break;
 
94
                default:
 
95
                        break;
 
96
        }
 
97
}
 
98
 
 
99
void KviTalGroupBox::addSpace(int iSpace)
 
100
{
 
101
        if(m_pLayout && m_pLayout==layout())
 
102
        {
 
103
                if(mOrientation == Qt::Vertical)
 
104
                        ((QHBoxLayout*)m_pLayout)->addSpacing(iSpace);
 
105
                else
 
106
                        ((QVBoxLayout*)m_pLayout)->addSpacing(iSpace);
 
107
        }
 
108
}
 
109
 
 
110
void KviTalGroupBox::setOrientation(Qt::Orientation orientation)
 
111
{
 
112
        if(m_pLayout)
 
113
        {
 
114
                delete m_pLayout;
 
115
                m_pLayout = NULL;
 
116
        }
 
117
 
 
118
        mOrientation = orientation;
 
119
 
 
120
        if(orientation == Qt::Vertical)
 
121
                m_pLayout = new QHBoxLayout(this);
 
122
        else
 
123
                m_pLayout = new QVBoxLayout(this);
 
124
        QGroupBox::setLayout(m_pLayout);
 
125
}
 
126
 
 
127
void KviTalGroupBox::setLayout(QLayout * layout)
 
128
{
 
129
        if(m_pLayout)
 
130
        {
 
131
                delete m_pLayout;
 
132
                m_pLayout = NULL;
 
133
        }
 
134
 
 
135
        QGroupBox::setLayout(layout);
 
136
}
 
137
 
 
138
#ifndef COMPILE_USE_STANDALONE_MOC_SOURCES
 
139
        #include "KviTalGroupBox.moc"
 
140
#endif //COMPILE_USE_STANDALONE_MOC_SOURCES