File indexing completed on 2025-03-09 03:52:10

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2014-09-18
0007  * Description : slideshow end view
0008  *
0009  * SPDX-FileCopyrightText: 2014-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0010  * SPDX-FileCopyrightText: 2019-2020 by Minh Nghia Duong <minhnghiaduong997 at gmail dot com>
0011  *
0012  * SPDX-License-Identifier: GPL-2.0-or-later
0013  *
0014  * ============================================================ */
0015 
0016 #include "slideend.h"
0017 
0018 // Qt includes
0019 
0020 #include <QLabel>
0021 #include <QGridLayout>
0022 #include <QPalette>
0023 #include <QStandardPaths>
0024 #include <QApplication>
0025 #include <QStyle>
0026 
0027 // KDE includes
0028 
0029 #include <klocalizedstring.h>
0030 
0031 namespace DigikamGenericSlideShowPlugin
0032 {
0033 
0034 SlideEnd::SlideEnd(QWidget* const parent)
0035     : QWidget(parent)
0036 {
0037     setMouseTracking(true);
0038     setAutoFillBackground(true);
0039 
0040     const int spacing = qMin(QApplication::style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing),
0041                              QApplication::style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing));
0042 
0043     QPalette palette;
0044     palette.setColor(backgroundRole(), Qt::black);
0045     palette.setColor(foregroundRole(), Qt::white);
0046     setPalette(palette);
0047 
0048     QFont fn(font());
0049     fn.setPointSize(fn.pointSize() + 10);
0050     fn.setBold(true);
0051     setFont(fn);
0052 
0053     QLabel* const logoLabel = new QLabel(this);
0054     logoLabel->setAlignment(Qt::AlignTop);
0055 
0056     QPixmap logo;
0057 
0058     if (QApplication::applicationName() == QLatin1String("digikam"))
0059     {
0060         logo = QIcon::fromTheme(QLatin1String("digikam")).pixmap(QSize(48,48));
0061     }
0062     else
0063     {
0064         logo = QIcon::fromTheme(QLatin1String("showfoto")).pixmap(QSize(48,48));
0065     }
0066 
0067     logoLabel->setPixmap(logo);
0068 
0069     QLabel* const textLabel = new QLabel(i18n("Slideshow Completed.\nClick To Exit\nor press ESC..."), this);
0070 
0071     QGridLayout* const grid = new QGridLayout(this);
0072     grid->addWidget(logoLabel, 1, 1, 1, 1);
0073     grid->addWidget(textLabel, 1, 2, 1, 1);
0074     grid->setColumnStretch(0, 1);
0075     grid->setColumnStretch(2, 10);
0076     grid->setRowStretch(0, 1);
0077     grid->setRowStretch(2, 10);
0078     grid->setContentsMargins(spacing, spacing, spacing, spacing);
0079     grid->setSpacing(spacing);
0080 }
0081 
0082 SlideEnd::~SlideEnd()
0083 {
0084 }
0085 
0086 } // namespace DigikamGenericSlideShowPlugin
0087 
0088 #include "moc_slideend.cpp"