00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include <mxcpcMessageDialog.h>
00021 #include <mxcpc_gui_config.h>
00022
00023 #include <QHBoxLayout>
00024 #include <QVBoxLayout>
00025 #include <QPixmap>
00026 #include <QLabel>
00027 #include <QPushButton>
00028
00029
00030
00031 mxcpcMessageDialog::mxcpcMessageDialog(QWidget *parent)
00032 : mxcpcDialog(parent) {
00033
00034 QHBoxLayout *h_layout;
00035 QVBoxLayout *v_layout;
00036 QLabel *label;
00037 QPushButton *button;
00038 QWidget *widget;
00039
00040 setWindowTitle(QString("Mx Message"));
00041
00042 h_layout = new QHBoxLayout(this);
00043 h_layout->setSizeConstraint(QLayout::SetFixedSize);
00044 h_layout->setSpacing(MXCPC_DIALOG_SPACING);
00045
00046 label = new QLabel(this);
00047 h_layout->addWidget(label, 0, Qt::AlignTop);
00048 label->setPixmap(QPixmap(":images/dialog_message.png"));
00049
00050 widget = new QWidget(this);
00051 h_layout->addWidget(widget);
00052
00053 v_layout = new QVBoxLayout(widget);
00054 v_layout->setSpacing(MXCPC_DIALOG_SPACING);
00055
00056 MessageTextLabel = label = new QLabel(QString("<Message>"), widget);
00057 v_layout->addWidget(label, 0, Qt::AlignHCenter);
00058
00059 button = new QPushButton(QString("Close"), widget);
00060 v_layout->addWidget(button, 0, Qt::AlignHCenter);
00061 button->setDefault(true);
00062 button->setSizePolicy(QSizePolicy(QSizePolicy::Fixed,
00063 QSizePolicy::Preferred));
00064 QObject::connect(button, SIGNAL(clicked(void)),
00065 this, SLOT(hide(void)));
00066 }
00067
00068
00069 void mxcpcMessageDialog::setMessage(const QString& title,
00070 const QString& message) {
00071
00072 setWindowTitle(title);
00073 MessageTextLabel->setText(message);
00074 }
00075