MCPcopy Create free account
hub / github.com/KDE/labplot / AboutDialog

Method AboutDialog

src/frontend/AboutDialog.cpp:78–128  ·  view source on GitHub ↗

! \class AboutDialog \brief Custom about dialog (not used at the moment) \ingroup frontend */ AboutDialog::AboutDialog(const KAboutData& aboutData, QWidget* parent) : QDialog(parent), aboutData(aboutData) {

Source from the content-addressed store, hash-verified

76 */
77//AboutDialog::AboutDialog(const KAboutData& aboutData, QWidget* parent) : QDialog(parent), aboutData(aboutData) {
78AboutDialog::AboutDialog(const KAboutData& aboutData, QWidget* parent) : KAboutApplicationDialog(aboutData, parent) {
79
80 //const auto homepage = aboutData.homepage();
81
82 QString text = QStringLiteral("<a href=\"https://labplot.org/changelog/#%1\">").arg(QLatin1String(LVERSION)) + i18n("What's new") + QStringLiteral("</a>");
83 auto* linkLabel = new QLabel();
84 linkLabel->setOpenExternalLinks(true);
85 linkLabel->setText(text.replace(QLatin1Char('\n'), QStringLiteral("<br />")));
86
87 // button to copy config
88 auto* copyEnvButton = new QPushButton(i18n("Copy Environment"));
89 copyEnvButton->setIcon(QIcon::fromTheme(QLatin1String("edit-copy")));
90 connect(copyEnvButton, &QPushButton::clicked, this, &AboutDialog::copyEnvironment);
91
92 // button to copy citation
93 auto* copyCiteButton = new QPushButton(i18n("Copy Citation"));
94 copyCiteButton->setIcon(QIcon::fromTheme(QLatin1String("edit-copy")));
95 connect(copyCiteButton, &QPushButton::clicked, this, &AboutDialog::copyCitation);
96
97 auto* donateButton = new QPushButton(i18n("Donate"));
98 donateButton->setIcon(QIcon::fromTheme(QLatin1String("love-symbolic")));
99 connect(donateButton, &QPushButton::clicked, this, &AboutDialog::openDonateLink);
100
101 auto* linkCopyLayout = new QHBoxLayout;
102 linkCopyLayout->addWidget(linkLabel);
103 linkCopyLayout->addStretch();
104 linkCopyLayout->addWidget(copyEnvButton);
105 linkCopyLayout->addWidget(copyCiteButton);
106 linkCopyLayout->addWidget(donateButton);
107
108 ((QVBoxLayout *)layout())->insertLayout(1, linkCopyLayout);
109
110 // when deriving from QDialog
111 //init();
112
113 // Find and hide the "Copy to Clipboard" button
114 auto buttons = findChildren<QPushButton *>();
115 for (auto* button : buttons) {
116 if (button->text() == i18n("Copy to Clipboard"))
117 button->hide();
118 }
119
120 // restore saved settings if available
121 create(); // ensure there's a window created
122 const auto conf = Settings::group(QStringLiteral("AboutDialog"));
123 if (conf.exists()) {
124 KWindowConfig::restoreWindowSize(windowHandle(), conf);
125 resize(windowHandle()->size()); // workaround for QTBUG-40584
126 } else
127 resize(QSize(400, 600).expandedTo(minimumSize()));
128}
129
130AboutDialog::~AboutDialog() {
131 // save current window size

Callers

nothing calls this directly

Calls 8

groupFunction · 0.85
argMethod · 0.80
replaceMethod · 0.80
existsMethod · 0.80
setTextMethod · 0.45
setIconMethod · 0.45
textMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected