kdeui: rework KAboutKdeDialog to expand the text as much as possible

also to parent widgets properly

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2024-04-15 22:55:46 +03:00
parent ddd6e8a034
commit 4857f6cd17

View file

@ -21,13 +21,12 @@
#include "kaboutkdedialog_p.h" #include "kaboutkdedialog_p.h"
#include <QFrame>
#include <QLabel> #include <QLabel>
#include <QLayout> #include <QLayout>
#include <QTabWidget>
#include <kdeversion.h> #include <kdeversion.h>
#include <kglobalsettings.h> #include <kglobalsettings.h>
#include <kpixmapwidget.h>
#include <klocale.h> #include <klocale.h>
#include <kstandarddirs.h> #include <kstandarddirs.h>
#include <ktitlewidget.h> #include <ktitlewidget.h>
@ -42,44 +41,48 @@ KAboutKdeDialog::KAboutKdeDialog(QWidget *parent)
setWindowTitle(i18n("About Katana")); setWindowTitle(i18n("About Katana"));
setButtons(KDialog::Close); setButtons(KDialog::Close);
KTitleWidget *titleWidget = new KTitleWidget(this); QWidget *mainWidget = new QWidget(this);
titleWidget->setText(i18n("<html><font size=\"5\">Katana - Be Free and Be Efficient!</font><br /><b>Platform Version %1</b></html>", QGridLayout *mainLayout = new QGridLayout(mainWidget);
QString(KDE_VERSION_STRING))); mainLayout->setMargin(0);
titleWidget->setPixmap(KIcon("kde").pixmap(48), KTitleWidget::ImageLeft); mainWidget->setLayout(mainLayout);
QLabel *about = new QLabel; KTitleWidget *titleWidget = new KTitleWidget(mainWidget);
titleWidget->setText(
i18n(
"<html><font size=\"5\">Katana - Be Free and Be Efficient!</font><br /><b>Platform Version %1</b></html>",
QString(KDE_VERSION_STRING)
)
);
titleWidget->setPixmap(KIcon("kde").pixmap(48), KTitleWidget::ImageLeft);
mainLayout->addWidget(titleWidget, 0, 0, 1, 2);
KPixmapWidget *image = new KPixmapWidget(mainWidget);
image->setPixmap(KStandardDirs::locate("data", "kdeui/pics/aboutkde.png"));
mainLayout->addWidget(image, 1, 0, 1, 1);
QLabel *about = new QLabel(mainWidget);
about->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
about->setMargin(10); about->setMargin(10);
about->setAlignment(Qt::AlignTop); about->setAlignment(Qt::AlignTop);
about->setWordWrap(true); about->setWordWrap(true);
about->setOpenExternalLinks(true); about->setOpenExternalLinks(true);
about->setTextInteractionFlags(Qt::TextBrowserInteraction); about->setTextInteractionFlags(Qt::TextBrowserInteraction);
about->setText(i18n("<html>" about->setText(
"<b>Katana</b> is fork of KDE Software Distribution with emphasis on efficiency." i18n("<html>"
"<br /><br />" "<b>Katana</b> is fork of KDE Software Distribution with emphasis on efficiency."
"Software can always be improved, and the Katana team is ready to do so. " "<br /><br />"
"However, you - the user - must tell us when something does not work as " "Software can always be improved, and the Katana team is ready to do so. "
"expected or could be done better. You do not have to be a software developer " "However, you - the user - must tell us when something does not work as "
"to be a member of the Katana team. You can join the national teams that " "expected or could be done better. You do not have to be a software developer "
"translate program interfaces. You can provide graphics, themes, sounds, and " "to be a member of the Katana team. You can join the national teams that "
"improved documentation. You decide!</html>" "translate program interfaces. You can provide graphics, themes, sounds, and "
"<br /><br />" "improved documentation. You decide!</html>"
"Visit <a href=\"%1\">%1</a> to learn more about Katana.</html>", "<br /><br />"
QLatin1String(KDE_HOME_URL))); "Visit <a href=\"%1\">%1</a> to learn more about Katana.</html>",
QLatin1String(KDE_HOME_URL)
QLabel *image = new QLabel; )
image->setPixmap(KStandardDirs::locate("data", "kdeui/pics/aboutkde.png")); );
mainLayout->addWidget(about, 1, 1, 1, 1);
QHBoxLayout *midLayout = new QHBoxLayout;
midLayout->addWidget(image);
midLayout->addWidget(about);
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addWidget(titleWidget);
mainLayout->addLayout(midLayout);
mainLayout->setMargin(0);
QWidget *mainWidget = new QWidget;
mainWidget->setLayout(mainLayout);
setMainWidget(mainWidget); setMainWidget(mainWidget);
} }