BibleTime
bteditbookmarkdialog.cpp
Go to the documentation of this file.
1 /*********
2 *
3 * In the name of the Father, and of the Son, and of the Holy Spirit.
4 *
5 * This file is part of BibleTime's source code, https://bibletime.info/
6 *
7 * Copyright 1999-2021 by the BibleTime developers.
8 * The BibleTime source code is licensed under the GNU General Public License
9 * version 2.0.
10 *
11 **********/
12 
13 #include "bteditbookmarkdialog.h"
14 
15 #include <QDialogButtonBox>
16 #include <QFlags>
17 #include <QFormLayout>
18 #include <QLabel>
19 #include <QLineEdit>
20 #include <QTextEdit>
21 #include <QTextOption>
22 #include <QVBoxLayout>
23 #include "../../util/btconnect.h"
24 #include "../../util/cresmgr.h"
25 #include "../messagedialog.h"
26 
27 
29  const QString &title,
30  const QString &description,
31  QWidget *parent,
32  Qt::WindowFlags wflags)
33  : QDialog(parent, wflags)
34 {
35  QVBoxLayout *mainLayout = new QVBoxLayout(this);
36 
37  resize(400, 300);
38  setWindowIcon(CResMgr::mainIndex::bookmark::icon());
39 
40  m_layout = new QFormLayout;
41 
42  m_keyLabel = new QLabel(this);
43  m_keyTextLabel = new QLabel(key, this);
45 
46  m_titleLabel = new QLabel(this);
47  m_titleEdit = new QLineEdit(title, this);
49 
50  m_descriptionLabel = new QLabel(this);
51  m_descriptionEdit = new QTextEdit(description, this);
52  m_descriptionEdit->setWordWrapMode(QTextOption::WordWrap);
54 
55  mainLayout->addLayout(m_layout);
56 
57  m_buttonBox = new QDialogButtonBox(QDialogButtonBox::Cancel
58  | QDialogButtonBox::NoButton
59  | QDialogButtonBox::Ok,
60  Qt::Horizontal,
61  this);
63  mainLayout->addWidget(m_buttonBox);
64 
65  BT_CONNECT(m_buttonBox, &QDialogButtonBox::accepted,
66  this, &BtEditBookmarkDialog::accept);
67  BT_CONNECT(m_buttonBox, &QDialogButtonBox::rejected,
68  this, &BtEditBookmarkDialog::reject);
69 
70  retranslateUi();
71 
72  m_titleEdit->setFocus();
73 }
74 
76  setWindowTitle(tr("Edit Bookmark"));
77  m_keyLabel->setText(tr("Location:"));
78  m_titleLabel->setText(tr("Title:"));
79  m_descriptionLabel->setText(tr("Description:"));
80 
81  /// \todo Add tooltips and what's this texts etc.
82 }
#define BT_CONNECT(...)
Definition: btconnect.h:20
QDialogButtonBox * m_buttonBox
BtEditBookmarkDialog(const QString &key, const QString &title, const QString &description, QWidget *parent=nullptr, Qt::WindowFlags wflags=Qt::Dialog)
void prepareDialogBox(QDialogButtonBox *box)