forgot to add some files :)
This commit is contained in:
parent
df4af668a5
commit
ae41194e4b
2 changed files with 113 additions and 0 deletions
85
cockatrice/src/dlg_create_token.cpp
Normal file
85
cockatrice/src/dlg_create_token.cpp
Normal file
|
@ -0,0 +1,85 @@
|
|||
#include <QtGui>
|
||||
#include "dlg_create_token.h"
|
||||
|
||||
DlgCreateToken::DlgCreateToken(QWidget *parent)
|
||||
: QDialog(parent)
|
||||
{
|
||||
nameLabel = new QLabel(tr("&Name:"));
|
||||
nameEdit = new QLineEdit;
|
||||
nameLabel->setBuddy(nameEdit);
|
||||
|
||||
colorLabel = new QLabel(tr("C&olor:"));
|
||||
colorEdit = new QComboBox;
|
||||
colorEdit->addItem(tr("white"), "w");
|
||||
colorEdit->addItem(tr("blue"), "u");
|
||||
colorEdit->addItem(tr("black"), "b");
|
||||
colorEdit->addItem(tr("red"), "r");
|
||||
colorEdit->addItem(tr("green"), "g");
|
||||
colorEdit->addItem(tr("multicolor"), "m");
|
||||
colorEdit->addItem(tr("colorless"), "");
|
||||
colorLabel->setBuddy(colorEdit);
|
||||
|
||||
ptLabel = new QLabel(tr("&P/T:"));
|
||||
ptEdit = new QLineEdit;
|
||||
ptLabel->setBuddy(ptEdit);
|
||||
|
||||
annotationLabel = new QLabel(tr("&Annotation:"));
|
||||
annotationEdit = new QLineEdit;
|
||||
annotationLabel->setBuddy(annotationEdit);
|
||||
|
||||
okButton = new QPushButton(tr("&OK"));
|
||||
okButton->setDefault(true);
|
||||
cancelButton = new QPushButton(tr("&Cancel"));
|
||||
|
||||
QGridLayout *grid = new QGridLayout;
|
||||
grid->addWidget(nameLabel, 0, 0);
|
||||
grid->addWidget(nameEdit, 0, 1);
|
||||
grid->addWidget(colorLabel, 1, 0);
|
||||
grid->addWidget(colorEdit, 1, 1);
|
||||
grid->addWidget(ptLabel, 2, 0);
|
||||
grid->addWidget(ptEdit, 2, 1);
|
||||
grid->addWidget(annotationLabel, 3, 0);
|
||||
grid->addWidget(annotationEdit, 3, 1);
|
||||
|
||||
QHBoxLayout *buttonLayout = new QHBoxLayout;
|
||||
buttonLayout->addStretch();
|
||||
buttonLayout->addWidget(okButton);
|
||||
buttonLayout->addWidget(cancelButton);
|
||||
|
||||
QVBoxLayout *mainLayout = new QVBoxLayout;
|
||||
mainLayout->addLayout(grid);
|
||||
mainLayout->addLayout(buttonLayout);
|
||||
setLayout(mainLayout);
|
||||
|
||||
setWindowTitle(tr("Create token"));
|
||||
setFixedHeight(sizeHint().height());
|
||||
setMinimumWidth(300);
|
||||
|
||||
connect(okButton, SIGNAL(clicked()), this, SLOT(actOk()));
|
||||
connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
|
||||
}
|
||||
|
||||
void DlgCreateToken::actOk()
|
||||
{
|
||||
accept();
|
||||
}
|
||||
|
||||
QString DlgCreateToken::getName() const
|
||||
{
|
||||
return nameEdit->text();
|
||||
}
|
||||
|
||||
QString DlgCreateToken::getColor() const
|
||||
{
|
||||
return colorEdit->itemData(colorEdit->currentIndex()).toString();
|
||||
}
|
||||
|
||||
QString DlgCreateToken::getPT() const
|
||||
{
|
||||
return ptEdit->text();
|
||||
}
|
||||
|
||||
QString DlgCreateToken::getAnnotation() const
|
||||
{
|
||||
return annotationEdit->text();
|
||||
}
|
28
cockatrice/src/dlg_create_token.h
Normal file
28
cockatrice/src/dlg_create_token.h
Normal file
|
@ -0,0 +1,28 @@
|
|||
#ifndef DLG_CREATETOKEN_H
|
||||
#define DLG_CREATETOKEN_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QLineEdit>
|
||||
|
||||
class QLabel;
|
||||
class QComboBox;
|
||||
class QPushButton;
|
||||
|
||||
class DlgCreateToken : public QDialog {
|
||||
Q_OBJECT
|
||||
public:
|
||||
DlgCreateToken(QWidget *parent = 0);
|
||||
QString getName() const;
|
||||
QString getColor() const;
|
||||
QString getPT() const;
|
||||
QString getAnnotation() const;
|
||||
private slots:
|
||||
void actOk();
|
||||
private:
|
||||
QLabel *nameLabel, *colorLabel, *ptLabel, *annotationLabel;
|
||||
QComboBox *colorEdit;
|
||||
QLineEdit *nameEdit, *ptEdit, *annotationEdit;
|
||||
QPushButton *okButton, *cancelButton;
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Reference in a new issue