44
42
class StretchLogoLabel : public QLabel
47
StretchLogoLabel(QPixmap pix, QWidget *label, const char *name = 0)
48
: QLabel((QWidget*)label->parent(), name)
45
StretchLogoLabel(QPixmap pix, QWidget *label)
46
: QLabel(label->parentWidget())
51
setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
52
49
replaceWidget(label, this);
50
setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum));
54
QSize sizeHint() const
56
QSize sh = QLabel::sizeHint();
57
sh.setHeight(pixmap_.height());
55
61
void paintEvent(QPaintEvent *event)
57
QPainter *p = new QPainter(this);
58
p->drawTiledPixmap(0, 0, width(), height(), *pixmap());
60
QLabel::paintEvent(event);
64
p.fillRect(rect(), Qt::red);
65
p.drawTiledPixmap(0, 0, width(), height(), pixmap_);
72
//----------------------------------------------------------------------------
74
//----------------------------------------------------------------------------
64
76
ProfileOpenDlg::ProfileOpenDlg(const QString &def, const VarList &_langs, const QString &curLang, QWidget *parent)
69
setWindowTitle(CAP(caption()));
81
setWindowTitle(CAP(windowTitle()));
70
82
pb_open->setDefault(true);
75
86
QPixmap logo = (QPixmap)IconsetFactory::icon("psi/psiLogo").pixmap();
76
87
lb_logo->setPixmap(logo);
77
88
lb_logo->setFixedSize(logo.width(), logo.height());
78
89
lb_logo->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
79
90
//setFixedWidth(logo->width());
81
QImage logoImg = logo.convertToImage();
84
tmp.convertFromImage( logoImg.copy(0, 0, 1, logoImg.height()) );
85
StretchLogoLabel *stretch = new StretchLogoLabel(tmp, lb_left);
87
tmp.convertFromImage( logoImg.copy(logoImg.width()-1, 0, 1, logoImg.height()) );
88
stretch = new StretchLogoLabel(tmp, lb_right);
92
QImage logoImg = logo.toImage();
93
new StretchLogoLabel(QPixmap::fromImage( logoImg.copy(0, 0, 1, logoImg.height()) ), lb_left);
94
new StretchLogoLabel(QPixmap::fromImage( logoImg.copy(logoImg.width()-1, 0, 1, logoImg.height()) ), lb_right);
91
96
connect(pb_open, SIGNAL(clicked()), SLOT(accept()));
92
97
connect(pb_close, SIGNAL(clicked()), SLOT(reject()));
93
98
connect(pb_profiles, SIGNAL(clicked()), SLOT(manageProfiles()));
176
//----------------------------------------------------------------------------
178
//----------------------------------------------------------------------------
173
180
ProfileManageDlg::ProfileManageDlg(const QString &choose, QWidget *parent)
178
setWindowTitle(CAP(caption()));
185
setWindowTitle(CAP(windowTitle()));
181
188
connect(pb_new, SIGNAL(clicked()), SLOT(slotProfileNew()));
182
189
connect(pb_rename, SIGNAL(clicked()), SLOT(slotProfileRename()));
183
190
connect(pb_delete, SIGNAL(clicked()), SLOT(slotProfileDelete()));
184
connect(pb_close, SIGNAL(clicked()), SLOT(reject()));
185
connect(lbx_profiles, SIGNAL(highlighted(int)), SLOT(updateSelection()));
191
connect(lbx_profiles, SIGNAL(currentRowChanged(int)), SLOT(updateSelection()));
187
193
// load the listing
188
194
QStringList list = getProfilesList();
190
196
for(QStringList::ConstIterator it = list.begin(); it != list.end(); ++it) {
191
lbx_profiles->insertItem(*it);
197
lbx_profiles->addItem(*it);
192
198
if(*it == choose)
193
lbx_profiles->setCurrentItem(x);
199
lbx_profiles->setCurrentRow(x);
219
225
void ProfileManageDlg::slotProfileRename()
221
int x = lbx_profiles->currentItem();
227
int x = lbx_profiles->currentRow();
225
QString oldname = lbx_profiles->text(x);
231
QString oldname = lbx_profiles->item(x)->text();
230
name = QInputDialog::getText(CAP(tr("Rename Profile")), tr("Please enter a new name for the profile. Keep it simple.\nOnly use letters or numbers. No punctuation or spaces."), QLineEdit::Normal, name, &ok, this);
236
name = QInputDialog::getText(this, CAP(tr("Rename Profile")), tr("Please enter a new name for the profile. Keep it simple.\nOnly use letters or numbers. No punctuation or spaces."), QLineEdit::Normal, name, &ok);
245
lbx_profiles->changeItem(name, x);
251
lbx_profiles->item(x)->setText(name);
248
254
void ProfileManageDlg::slotProfileDelete()
250
int x = lbx_profiles->currentItem();
256
int x = lbx_profiles->currentRow();
253
QString name = lbx_profiles->text(x);
259
QString name = lbx_profiles->item(x)->text();
254
260
QString path = ApplicationInfo::profilesDir() + "/" + name;
286
lbx_profiles->removeItem(x);
293
delete lbx_profiles->item(x);
290
297
void ProfileManageDlg::updateSelection()
292
int x = lbx_profiles->currentItem();
299
int x = lbx_profiles->currentRow();
295
pb_rename->setEnabled(false);
302
// pb_rename->setEnabled(false);
296
303
pb_delete->setEnabled(false);
299
pb_rename->setEnabled(true);
306
// pb_rename->setEnabled(true);
300
307
pb_delete->setEnabled(true);
311
//----------------------------------------------------------------------------
313
//----------------------------------------------------------------------------
305
315
ProfileNewDlg::ProfileNewDlg(QWidget *parent)
310
setWindowTitle(CAP(caption()));
312
bg_defAct->setButton(bg_defAct->id((Q3Button *)rb_chat));
320
setWindowTitle(CAP(windowTitle()));
322
buttonGroup_ = new QButtonGroup(this);
323
buttonGroup_->addButton(rb_message, 0);
324
buttonGroup_->addButton(rb_chat, 1);
325
rb_chat->setChecked(true);
313
327
le_name->setFocus();
315
329
connect(pb_create, SIGNAL(clicked()), SLOT(slotCreate()));