- QHBoxLayout *horizontalLayout = new QHBoxLayout(this);
- horizontalLayout->addWidget(info);
- horizontalLayout->addWidget(buttonBox);
- setLayout(horizontalLayout);
+ if (book) {
+ QLabel *title = new QLabel(book->title, this);
+ addWidget(title);
+ if (book->subject != "") {
+ QLabel *subject = new QLabel(book->subject, this);
+ addWidget(subject);
+ }
+ if (book->creators.size()) {
+ QLabel *creators = new QLabel(this);
+ QString c = "By " + book->creators[0];
+ for (int i = 1; i < book->creators.size(); i++) {
+ c += ", " + book->creators[i];
+ }
+ creators->setText(c);
+ addWidget(creators);
+ }
+ QLabel *path = new QLabel("File: " + book->path(), this);
+ addWidget(path);
+ if (book->publisher != "") {
+ QLabel *publisher =
+ new QLabel("Published by " + book->publisher, this);
+ addWidget(publisher);
+ }
+ if (book->source != "") {
+ QLabel *source = new QLabel("Source: " + book->source, this);
+ addWidget(source);
+ }
+ if (book->rights != "") {
+ QLabel *rights = new QLabel(book->rights, this);
+ addWidget(rights);
+ }
+ addStretch();
+ }
+
+ addButton(tr("Read"), this, SLOT(onReadBook()),
+ QDialogButtonBox::ActionRole);
+ addButton(tr("Delete"), this, SLOT(onRemoveBook()),
+ QDialogButtonBox::DestructiveRole);