1
/****************************************************************************
2
** profiledlg.cpp - dialogs for manipulating profiles
3
** Copyright (C) 2001, 2002 Justin Karneges
5
** This program is free software; you can redistribute it and/or
6
** modify it under the terms of the GNU General Public License
7
** as published by the Free Software Foundation; either version 2
8
** of the License, or (at your option) any later version.
10
** This program is distributed in the hope that it will be useful,
11
** but WITHOUT ANY WARRANTY; without even the implied warranty of
12
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
** GNU General Public License for more details.
15
** You should have received a copy of the GNU General Public License
16
** along with this program; if not, write to the Free Software
17
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
19
****************************************************************************/
2
* profiledlg.cpp - dialogs for manipulating profiles
3
* Copyright (C) 2001-2003 Justin Karneges
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License
7
* as published by the Free Software Foundation; either version 2
8
* of the License, or (at your option) any later version.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this library; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
21
#include"profiledlg.h"
32
32
#include<qfileinfo.h>
33
33
#include<qbuttongroup.h>
34
#include<qwhatsthis.h>
34
35
#include"profiles.h"
36
#include"iconwidget.h"
39
class StretchLogoLabel : public QLabel
42
StretchLogoLabel(QPixmap pix, QWidget *label, const char *name = 0)
43
: QLabel((QWidget*)label->parent(), name)
46
setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
47
replaceWidget(label, this);
50
void drawContents(QPainter *p)
52
p->drawTiledPixmap(0, 0, width(), height(), *pixmap());
37
56
ProfileOpenDlg::ProfileOpenDlg(const QString &def, const VarList &_langs, const QString &curLang, QWidget *parent, const char *name)
38
57
:ProfileOpenUI(parent, name, TRUE)
40
setCaption(CAP(tr("Open Profile")));
59
setCaption(CAP(caption()));
45
QPixmap *logo = pix_logo;
46
lb_logo->setPixmap(*logo);
47
lb_logo->setFixedSize(logo->width(), logo->height());
64
QPixmap logo = (QPixmap)IconsetFactory::icon("psi/psiLogo").pixmap();
65
lb_logo->setPixmap(logo);
66
lb_logo->setFixedSize(logo.width(), logo.height());
48
67
lb_logo->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
49
setFixedWidth(logo->width());
68
//setFixedWidth(logo->width());
70
QImage logoImg = logo.convertToImage();
73
tmp.convertFromImage( logoImg.copy(0, 0, 1, logoImg.height()) );
74
StretchLogoLabel *stretch = new StretchLogoLabel(tmp, lb_left);
76
tmp.convertFromImage( logoImg.copy(logoImg.width()-1, 0, 1, logoImg.height()) );
77
stretch = new StretchLogoLabel(tmp, lb_right);
52
80
connect(pb_open, SIGNAL(clicked()), SLOT(accept()));
55
83
connect(cb_lang, SIGNAL(activated(int)), SLOT(langChange(int)));
58
87
for(VarList::ConstIterator it = langs.begin(); it != langs.end(); ++it) {
59
88
cb_lang->insertItem((*it).data());
60
89
if((curLang.isEmpty() && x == 0) || (curLang == (*it).key())) {
61
90
cb_lang->setCurrentItem(x);
97
QWhatsThis::add(cb_profile,
98
tr("Select a profile to open from this list."));
99
QWhatsThis::add(cb_lang,
100
tr("Select a language you would like Psi to use from this "
101
"list. You can download extra language packs from the Psi homepage."));
102
QWhatsThis::add(ck_auto,
103
tr("Automatically open this profile when Psi is started. Useful if "
104
"you only have one profile."));
109
ProfileOpenDlg::~ProfileOpenDlg()
69
113
void ProfileOpenDlg::reload(const QString &choose)
71
115
QStringList list = getProfilesList();
113
162
ProfileManageDlg::ProfileManageDlg(const QString &choose, QWidget *parent, const char *name)
114
163
:ProfileManageUI(parent, name, TRUE)
116
setCaption(CAP(tr("Manage Profiles")));
165
setCaption(CAP(caption()));
119
168
connect(pb_new, SIGNAL(clicked()), SLOT(slotProfileNew()));
195
244
int r = QMessageBox::warning(this,
196
245
CAP(tr("Delete Profile")),
198
247
"<qt>Are you sure you want to delete the \"<b>%1</b>\" profile? "
199
248
"This will delete all of the profile's message history as well as associated settings!</qt>"
201
250
tr("No, I changed my mind"),
202
251
tr("Delete it!"));
207
256
r = QMessageBox::information(this,
208
257
CAP(tr("Delete Profile")),
210
259
"<qt>As a precaution, you are being asked one last time if this is what you really want. "
211
260
"The following folder will be deleted!<br><br>\n"
212
261
" <b>%1</b><br><br>\n"
243
292
ProfileNewDlg::ProfileNewDlg(QWidget *parent, const char *name)
244
293
:ProfileNewUI(parent, name, TRUE)
246
setCaption(CAP(tr("New Profile")));
295
setCaption(CAP(caption()));
248
297
bg_defAct->setButton(bg_defAct->id((QButton *)rb_chat));
249
298
le_name->setFocus();