3 // Originally part of QCad Community Edition by Andrew Mustun
4 // Extensively rewritten and refactored by James L. Hammons
5 // (C) 2010 Underground Software
7 // JLH = James L. Hammons <jlhamm@acm.org>
10 // --- ---------- -----------------------------------------------------------
11 // JLH 05/12/2010 Created this file. :-)
14 #include "exitdialog.h"
16 #include <QMessageBox>
18 ExitDialog::ExitDialog(QWidget * parent/*= NULL*/, Qt::WindowFlags flags/*= 0*/):
19 QDialog(parent, flags)
25 QMessageBox mb("", "", QMessageBox::Warning, QMessageBox::Ok, Qt::NoButton, Qt::NoButton);
26 l_icon->setPixmap(*mb.iconPixmap());
28 #warning "Needs porting to Qt4... !!! FIX !!!"
30 // Icons are now put on the form
31 // bLeave->setIconSet(qPixmapFromMimeSource("fileclose.png"));
32 // ui.bLeave->setIcon(QIcon(":/images/fileclose.png"));
33 makeLetterAccel(ui.bLeave);
34 // bSave->setIconSet(qPixmapFromMimeSource("filesave2.png"));
35 // ui.bSave->setIcon(QIcon(":/images/filesave2.png"));
36 makeLetterAccel(ui.bSave);
37 // bSaveAs->setIconSet(qPixmapFromMimeSource("filesaveas.png"));
38 // ui.bSaveAs->setIcon(QIcon(":/images/filesaveas.png"));
39 makeLetterAccel(ui.bSaveAs);
40 makeLetterAccel(ui.bCancel);
43 ExitDialog::~ExitDialog()
47 void ExitDialog::setText(const QString & text)
49 ui.lQuestion->setText(text);
51 resize(lQuestion->sizeHint().width() + 32,
52 lQuestion->sizeHint().height() + layButtons->sizeHint().height() + 32);
54 #warning "Needs porting to Qt4... !!! FIX !!!"
58 void ExitDialog::setTitle(const QString & text)
63 void ExitDialog::setForce(bool force)
65 ui.bCancel->setDisabled(force);
68 void ExitDialog::slotSaveAs()
73 void ExitDialog::slotSave()
78 //sets additional accel, eg. Key_A for ALT+Key_A
79 void ExitDialog::makeLetterAccel(QPushButton * btn)
82 if (btn->accel().count() < 1)
85 Q3Accel * a = new Q3Accel(btn);
86 a->connectItem(a->insertItem(btn->accel() & ~(Qt::MODIFIER_MASK | Qt::UNICODE_ACCEL)),
87 btn, SLOT(animateClick()));
89 #warning "Needs porting to Qt4... !!! FIX !!!"