00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00018
00019 #include <globalsearch/queueinterfaces/internaldialog.h>
00020
00021 #include <globalsearch/optbase.h>
00022 #include <globalsearch/queueinterfaces/internal.h>
00023 #include <globalsearch/ui/abstractdialog.h>
00024
00025 #include <QtGui/QDialog>
00026 #include <QtGui/QDialogButtonBox>
00027 #include <QtGui/QHBoxLayout>
00028 #include <QtGui/QLabel>
00029 #include <QtGui/QLineEdit>
00030 #include <QtGui/QSpacerItem>
00031 #include <QtGui/QVBoxLayout>
00032
00033 #include <QtCore/QObject>
00034
00035 namespace GlobalSearch {
00036
00037 InternalQueueInterfaceConfigDialog::InternalQueueInterfaceConfigDialog
00038 (AbstractDialog *parent, OptBase *opt, InternalQueueInterface *o)
00039 : QDialog(parent),
00040 m_opt(opt),
00041 m_queueInterface(o),
00042 m_edit_workdir(0),
00043 m_edit_description(0)
00044 {
00045 QVBoxLayout *vlayout = new QVBoxLayout(this);
00046
00047
00048 QHBoxLayout *workdir_layout = new QHBoxLayout();
00049
00050 QLabel *label = new QLabel
00051 (tr("Local working directory:"), this);
00052 workdir_layout->addWidget(label);
00053
00054 m_edit_workdir = new QLineEdit(this);
00055 workdir_layout->addWidget(m_edit_workdir);
00056
00057 vlayout->addItem(workdir_layout);
00058
00059
00060 QHBoxLayout *desc_layout = new QHBoxLayout();
00061
00062 label = new QLabel
00063 (tr("Search description:"), this);
00064 desc_layout->addWidget(label);
00065
00066 m_edit_description = new QLineEdit(this);
00067 desc_layout->addWidget(m_edit_description);
00068
00069 vlayout->addItem(desc_layout);
00070
00071
00072 QSpacerItem *spacer = new QSpacerItem
00073 (10,10, QSizePolicy::Minimum, QSizePolicy::Expanding);
00074 vlayout->addItem(spacer);
00075
00076 QDialogButtonBox *bbox = new QDialogButtonBox(this);
00077 bbox->setStandardButtons(QDialogButtonBox::Ok |
00078 QDialogButtonBox::Cancel );
00079 vlayout->addWidget(bbox);
00080
00081 setLayout(vlayout);
00082
00083 connect(bbox, SIGNAL(accepted()),
00084 this, SLOT(accept()));
00085 connect(bbox, SIGNAL(rejected()),
00086 this, SLOT(reject()));
00087 }
00088
00089 void InternalQueueInterfaceConfigDialog::accept()
00090 {
00091 m_opt->filePath = m_edit_workdir->text().trimmed();
00092 m_opt->description = m_edit_description->text().trimmed();
00093 QDialog::accept();
00094 this->close();
00095 }
00096
00097 void InternalQueueInterfaceConfigDialog::reject()
00098 {
00099 updateGUI();
00100 QDialog::reject();
00101 this->close();
00102 }
00103
00104 void InternalQueueInterfaceConfigDialog::updateGUI()
00105 {
00106 m_edit_workdir->setText(m_opt->filePath);
00107 m_edit_description->setText(m_opt->description);
00108 }
00109
00110 }
00111