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

« back to all changes in this revision

Viewing changes to src/modules/options/container.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 : container.cpp
4
 
//   Creation date : Wed Nov 21 17:09:49 2001 GMT by Szymon Stefanek
5
 
//
6
 
//   This file is part of the KVirc irc client distribution
7
 
//   Copyright (C) 2001-2008 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 "container.h"
26
 
#include "instances.h"
27
 
 
28
 
#include "kvi_locale.h"
29
 
#include "kvi_iconmanager.h"
30
 
#include "kvi_app.h"
31
 
#include "kvi_tal_tooltip.h"
32
 
 
33
 
#include <QLayout>
34
 
#include <QPushButton>
35
 
#include <QDesktopWidget>
36
 
#include <QEvent>
37
 
#include <QGridLayout>
38
 
#include <QCloseEvent>
39
 
#include <QIcon>
40
 
 
41
 
 
42
 
extern KviOptionsInstanceManager * g_pOptionsInstanceManager;
43
 
 
44
 
KviOptionsWidgetContainer::KviOptionsWidgetContainer(QWidget * par,bool bModal)
45
 
: QDialog(par)
46
 
{
47
 
        m_pLayout = new QGridLayout(this);
48
 
 
49
 
        setObjectName("container");
50
 
        m_pOptionsWidget = 0;
51
 
        setModal(bModal);
52
 
}
53
 
 
54
 
KviOptionsWidgetContainer::~KviOptionsWidgetContainer()
55
 
{
56
 
        if(m_pOptionsWidget)delete m_pOptionsWidget;
57
 
}
58
 
 
59
 
void KviOptionsWidgetContainer::setLeftCornerWidget(QWidget * pWidget)
60
 
{
61
 
        if(!pWidget)
62
 
                return;
63
 
        m_pLayout->addWidget(pWidget,1,0);
64
 
}
65
 
 
66
 
 
67
 
void KviOptionsWidgetContainer::setup(KviOptionsWidget * w)
68
 
{
69
 
        m_pLayout->addWidget(w,0,0,1,3);
70
 
        //g->addMultiCellWidget(w,0,0,0,2);
71
 
 
72
 
        QPushButton * b = new QPushButton(__tr2qs_ctx("&OK","options"),this);
73
 
        KviTalToolTip::add(b,__tr2qs_ctx("Close this dialog, accepting all changes.","options"));
74
 
        //b->setMinimumWidth(m_pCancel->sizeHint().width());
75
 
        m_pLayout->addWidget(b,1,1);
76
 
        b->setDefault(true);
77
 
        connect(b,SIGNAL(clicked()),this,SLOT(okClicked()));
78
 
        b->setIcon(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_ACCEPT)));
79
 
 
80
 
        m_pCancel = new QPushButton(__tr2qs_ctx("Cancel","options"),this);
81
 
        KviTalToolTip::add(m_pCancel,__tr2qs_ctx("Close this dialog, discarding all changes.","options"));
82
 
        m_pLayout->addWidget(m_pCancel,1,2);
83
 
        connect(m_pCancel,SIGNAL(clicked()),this,SLOT(cancelClicked()));
84
 
        m_pCancel->setIcon(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_DISCARD)));
85
 
 
86
 
 
87
 
        m_pLayout->setRowStretch(0,1);
88
 
        m_pLayout->setColumnStretch(0,1);
89
 
 
90
 
        KviOptionsWidgetInstanceEntry * e = g_pOptionsInstanceManager->findInstanceEntry(w->metaObject()->className());
91
 
        if(e)
92
 
        {
93
 
                setWindowIcon(QIcon(*(g_pIconManager->getSmallIcon(e->iIcon))));
94
 
                setWindowTitle(e->szName);
95
 
        }
96
 
 
97
 
        m_pOptionsWidget = w;
98
 
}
99
 
 
100
 
void KviOptionsWidgetContainer::closeEvent(QCloseEvent *e)
101
 
{
102
 
        e->ignore();
103
 
        cancelClicked();
104
 
}
105
 
 
106
 
void KviOptionsWidgetContainer::showEvent(QShowEvent *e)
107
 
{
108
 
        if(parent() == 0)
109
 
        {
110
 
                QRect rect = g_pApp->desktop()->screenGeometry(g_pApp->desktop()->primaryScreen());
111
 
                move((rect.width() - width())/2,(rect.height() - height())/2);
112
 
        }
113
 
        QWidget::showEvent(e);
114
 
        m_pCancel->setFocus();
115
 
}
116
 
 
117
 
void KviOptionsWidgetContainer::reject()
118
 
{
119
 
        cancelClicked();
120
 
}
121
 
 
122
 
void KviOptionsWidgetContainer::okClicked()
123
 
{
124
 
        if(m_pOptionsWidget)m_pOptionsWidget->commit();
125
 
        g_pApp->saveOptions();
126
 
        delete this;
127
 
}
128
 
 
129
 
void KviOptionsWidgetContainer::cancelClicked()
130
 
{
131
 
        deleteLater();
132
 
}
133
 
 
134
 
#ifndef COMPILE_USE_STANDALONE_MOC_SOURCES
135
 
#include "m_container.moc"
136
 
#endif //!COMPILE_USE_STANDALONE_MOC_SOURCES