From b879b2c208d7a2af02c6e50b70ab28bd1f1f67f9 Mon Sep 17 00:00:00 2001 From: Le Tan Date: Sun, 26 Feb 2017 20:01:29 +0800 Subject: [PATCH] change file format from dos to unix --- src/dialog/vfileinfodialog.cpp | 118 ++++++++++++++++----------------- src/dialog/vfileinfodialog.h | 70 +++++++++---------- 2 files changed, 94 insertions(+), 94 deletions(-) diff --git a/src/dialog/vfileinfodialog.cpp b/src/dialog/vfileinfodialog.cpp index 5cc7b9e9..f2d3eee3 100644 --- a/src/dialog/vfileinfodialog.cpp +++ b/src/dialog/vfileinfodialog.cpp @@ -1,59 +1,59 @@ -#include -#include "vfileinfodialog.h" - -VFileInfoDialog::VFileInfoDialog(const QString &title, const QString &info, - const QString &defaultName, - QWidget *parent) - : QDialog(parent), infoLabel(NULL), title(title), info(info), defaultName(defaultName) -{ - setupUI(); - - connect(nameEdit, &QLineEdit::textChanged, this, &VFileInfoDialog::enableOkButton); - - enableOkButton(); -} - -void VFileInfoDialog::setupUI() -{ - if (!info.isEmpty()) { - infoLabel = new QLabel(info); - } - nameLabel = new QLabel(tr("&Name:")); - nameEdit = new QLineEdit(defaultName); - nameEdit->selectAll(); - nameLabel->setBuddy(nameEdit); - - // Ok is the default button. - m_btnBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); - connect(m_btnBox, &QDialogButtonBox::accepted, this, &QDialog::accept); - connect(m_btnBox, &QDialogButtonBox::rejected, this, &QDialog::reject); - - QHBoxLayout *topLayout = new QHBoxLayout(); - topLayout->addWidget(nameLabel); - topLayout->addWidget(nameEdit); - - QPushButton *okBtn = m_btnBox->button(QDialogButtonBox::Ok); - nameEdit->setMinimumWidth(okBtn->sizeHint().width() * 3); - - QVBoxLayout *mainLayout = new QVBoxLayout(); - if (infoLabel) { - mainLayout->addWidget(infoLabel); - } - mainLayout->addLayout(topLayout); - mainLayout->addWidget(m_btnBox); - mainLayout->setSizeConstraint(QLayout::SetFixedSize); - setLayout(mainLayout); - - setWindowTitle(title); -} - -void VFileInfoDialog::enableOkButton() -{ - QPushButton *okBtn = m_btnBox->button(QDialogButtonBox::Ok); - okBtn->setEnabled(!nameEdit->text().isEmpty()); -} - -QString VFileInfoDialog::getNameInput() const -{ - return nameEdit->text(); -} +#include +#include "vfileinfodialog.h" + +VFileInfoDialog::VFileInfoDialog(const QString &title, const QString &info, + const QString &defaultName, + QWidget *parent) + : QDialog(parent), infoLabel(NULL), title(title), info(info), defaultName(defaultName) +{ + setupUI(); + + connect(nameEdit, &QLineEdit::textChanged, this, &VFileInfoDialog::enableOkButton); + + enableOkButton(); +} + +void VFileInfoDialog::setupUI() +{ + if (!info.isEmpty()) { + infoLabel = new QLabel(info); + } + nameLabel = new QLabel(tr("&Name:")); + nameEdit = new QLineEdit(defaultName); + nameEdit->selectAll(); + nameLabel->setBuddy(nameEdit); + + // Ok is the default button. + m_btnBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); + connect(m_btnBox, &QDialogButtonBox::accepted, this, &QDialog::accept); + connect(m_btnBox, &QDialogButtonBox::rejected, this, &QDialog::reject); + + QHBoxLayout *topLayout = new QHBoxLayout(); + topLayout->addWidget(nameLabel); + topLayout->addWidget(nameEdit); + + QPushButton *okBtn = m_btnBox->button(QDialogButtonBox::Ok); + nameEdit->setMinimumWidth(okBtn->sizeHint().width() * 3); + + QVBoxLayout *mainLayout = new QVBoxLayout(); + if (infoLabel) { + mainLayout->addWidget(infoLabel); + } + mainLayout->addLayout(topLayout); + mainLayout->addWidget(m_btnBox); + mainLayout->setSizeConstraint(QLayout::SetFixedSize); + setLayout(mainLayout); + + setWindowTitle(title); +} + +void VFileInfoDialog::enableOkButton() +{ + QPushButton *okBtn = m_btnBox->button(QDialogButtonBox::Ok); + okBtn->setEnabled(!nameEdit->text().isEmpty()); +} + +QString VFileInfoDialog::getNameInput() const +{ + return nameEdit->text(); +} diff --git a/src/dialog/vfileinfodialog.h b/src/dialog/vfileinfodialog.h index dc7fe462..555ae7c8 100644 --- a/src/dialog/vfileinfodialog.h +++ b/src/dialog/vfileinfodialog.h @@ -1,35 +1,35 @@ -#ifndef VFILEINFODIALOG_H -#define VFILEINFODIALOG_H - -#include - -class QLabel; -class QLineEdit; -class QDialogButtonBox; -class QString; - -class VFileInfoDialog : public QDialog -{ - Q_OBJECT -public: - VFileInfoDialog(const QString &title, const QString &info, const QString &defaultName, - QWidget *parent = 0); - QString getNameInput() const; - -private slots: - void enableOkButton(); - -private: - void setupUI(); - - QLabel *infoLabel; - QLabel *nameLabel; - QLineEdit *nameEdit; - QDialogButtonBox *m_btnBox; - - QString title; - QString info; - QString defaultName; -}; - -#endif // VFILEINFODIALOG_H +#ifndef VFILEINFODIALOG_H +#define VFILEINFODIALOG_H + +#include + +class QLabel; +class QLineEdit; +class QDialogButtonBox; +class QString; + +class VFileInfoDialog : public QDialog +{ + Q_OBJECT +public: + VFileInfoDialog(const QString &title, const QString &info, const QString &defaultName, + QWidget *parent = 0); + QString getNameInput() const; + +private slots: + void enableOkButton(); + +private: + void setupUI(); + + QLabel *infoLabel; + QLabel *nameLabel; + QLineEdit *nameEdit; + QDialogButtonBox *m_btnBox; + + QString title; + QString info; + QString defaultName; +}; + +#endif // VFILEINFODIALOG_H