| 17 | } |
| 18 | |
| 19 | void CreateLibraryDialog::setupUI() |
| 20 | { |
| 21 | textLabel = new QLabel(tr("Comics folder : ")); |
| 22 | path = new QLineEdit; |
| 23 | textLabel->setBuddy(path); |
| 24 | connect(path, &QLineEdit::textChanged, this, &CreateLibraryDialog::pathSetted); |
| 25 | |
| 26 | nameLabel = new QLabel(tr("Library Name : ")); |
| 27 | nameEdit = new QLineEdit; |
| 28 | nameLabel->setBuddy(nameEdit); |
| 29 | connect(nameEdit, &QLineEdit::textChanged, this, &CreateLibraryDialog::nameSetted); |
| 30 | |
| 31 | accept = new QPushButton(tr("Create")); |
| 32 | accept->setDisabled(true); |
| 33 | connect(accept, &QAbstractButton::clicked, this, &CreateLibraryDialog::create); |
| 34 | |
| 35 | cancel = new QPushButton(tr("Cancel")); |
| 36 | connect(cancel, &QAbstractButton::clicked, this, &CreateLibraryDialog::cancelCreate); |
| 37 | connect(cancel, &QAbstractButton::clicked, this, &CreateLibraryDialog::close); |
| 38 | |
| 39 | find = new QPushButton(""); |
| 40 | connect(find, &QAbstractButton::clicked, this, &CreateLibraryDialog::findPath); |
| 41 | |
| 42 | auto content = new QGridLayout; |
| 43 | |
| 44 | // QHBoxLayout *nameLayout = new QHBoxLayout; |
| 45 | |
| 46 | content->addWidget(nameLabel, 0, 0); |
| 47 | content->addWidget(nameEdit, 0, 1); |
| 48 | |
| 49 | // QHBoxLayout *libraryLayout = new QHBoxLayout; |
| 50 | |
| 51 | content->addWidget(textLabel, 1, 0); |
| 52 | content->addWidget(path, 1, 1); |
| 53 | content->addWidget(find, 1, 2); |
| 54 | content->setColumnMinimumWidth(2, 0); // TODO |
| 55 | |
| 56 | auto bottomLayout = new QHBoxLayout; |
| 57 | bottomLayout->addWidget(message = new QLabel(tr("Create a library could take several minutes. You can stop the process and update the library later for completing the task."))); |
| 58 | message->setWordWrap(true); |
| 59 | // message->hide(); |
| 60 | bottomLayout->addStretch(); |
| 61 | bottomLayout->addWidget(accept); |
| 62 | bottomLayout->addWidget(cancel); |
| 63 | |
| 64 | auto mainLayout = new QVBoxLayout; |
| 65 | mainLayout->addLayout(content); |
| 66 | |
| 67 | mainLayout->addLayout(bottomLayout); |
| 68 | |
| 69 | auto imgMainLayout = new QHBoxLayout; |
| 70 | imgLabel = new QLabel(this); |
| 71 | imgMainLayout->addWidget(imgLabel); |
| 72 | imgMainLayout->addLayout(mainLayout); |
| 73 | |
| 74 | setLayout(imgMainLayout); |
| 75 | |
| 76 | setModal(true); |
nothing calls this directly
no test coverage detected