diff --git a/MainWindow/FeatureDialog.cpp b/MainWindow/FeatureDialog.cpp index b9bec885..410c41a4 100644 --- a/MainWindow/FeatureDialog.cpp +++ b/MainWindow/FeatureDialog.cpp @@ -1,210 +1,208 @@ /* Copyright (C) 2003-2020 The KPhotoAlbum Development Team This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "FeatureDialog.h" #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace MainWindow; FeatureDialog::FeatureDialog(QWidget *parent) : QDialog(parent) { setWindowTitle(i18nc("@title:window", "Feature Status")); QTextBrowser *browser = new QTextBrowser(this); QString text = i18n("

Overview

" "

Below you may see the list of compile- and runtime features KPhotoAlbum has, and their status:

" "%1", featureString()); text += i18n("

What can I do if I miss a feature?

" "

If you compiled KPhotoAlbum yourself, then please review the sections below to learn what to install " "to get the feature in question. If on the other hand you installed KPhotoAlbum from a binary package, please tell " "whoever made the package about this defect, eventually including the information from the section below.

" "

In case you are missing a feature and you did not compile KPhotoAlbum yourself, please do consider doing so. " "It really is not that hard. If you need help compiling KPhotoAlbum, feel free to ask on the " "KPhotoAlbum mailing list

" "

The steps to compile KPhotoAlbum can be seen on " "the KPhotoAlbum home page. If you have never compiled a KDE application, then please ensure that " "you have the developer packages installed, in most distributions they go under names like kdelibs-devel

"); text += i18n("

Plugin support

" "

KPhotoAlbum supports the Purpose plugin system.

"); text += i18n("

SQLite database support

" "

KPhotoAlbum allows you to search using a certain number of Exif tags. For this KPhotoAlbum " "needs an SQLite database. " "In addition the Qt package for SQLite (e.g. qt-sql-sqlite) must be installed.

"); text += i18n("

Map view for geotagged images

" "

If KPhotoAlbum has been built with support for Marble, " "KPhotoAlbum can show images with GPS information on a map." "

"); text += i18n("

Video support

" - "

KPhotoAlbum relies on Qt's Phonon architecture for displaying videos; this in turn relies on GStreamer. " - "If this feature is not enabled for you, have a look at the " - "KPhotoAlbum wiki article on video support.

"); + "

KPhotoAlbum relies on Qt's Phonon architecture for displaying videos; this in turn relies on GStreamer.

"); QStringList mimeTypes = supportedVideoMimeTypes(); mimeTypes.sort(); if (mimeTypes.isEmpty()) text += i18n("

No video mime types found, which indicates that either Qt was compiled without phonon support, or there were missing codecs

"); else text += i18n("

Phonon is capable of playing movies of these mime types:

  • %1

", mimeTypes.join(QString::fromLatin1("
  • "))); text += i18n("

    Video thumbnail support

    " "

    KPhotoAlbum can use ffmpeg to extract thumbnails from videos. These thumbnails are used to preview " "videos in the thumbnail viewer.

    "); text += i18n("

    Video metadata support

    " "

    KPhotoAlbum can use ffprobe to extract length information from videos." "

    " "

    Correct length information is necessary for correct rendering of video thumbnails.

    "); browser->setText(text); QVBoxLayout *layout = new QVBoxLayout; layout->addWidget(browser); this->setLayout(layout); QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok); buttonBox->button(QDialogButtonBox::Ok)->setShortcut(Qt::CTRL | Qt::Key_Return); layout->addWidget(buttonBox); connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept); } QSize FeatureDialog::sizeHint() const { return QSize(800, 600); } bool MainWindow::FeatureDialog::hasPurposeSupport() { #ifdef KF5Purpose_FOUND return true; #else return false; #endif } bool MainWindow::FeatureDialog::hasEXIV2DBSupport() { return Exif::Database::isAvailable(); } bool MainWindow::FeatureDialog::hasGeoMapSupport() { #ifdef HAVE_MARBLE return true; #else return false; #endif } QString FeatureDialog::ffmpegBinary() { QString ffmpeg = QStandardPaths::findExecutable(QString::fromLatin1("ffmpeg")); return ffmpeg; } QString FeatureDialog::ffprobeBinary() { QString ffprobe = QStandardPaths::findExecutable(QString::fromLatin1("ffprobe")); return ffprobe; } bool FeatureDialog::hasVideoThumbnailer() { return !ffmpegBinary().isEmpty(); } bool FeatureDialog::hasVideoProber() { return !ffprobeBinary().isEmpty(); } bool MainWindow::FeatureDialog::hasAllFeaturesAvailable() { // Only answer those that are compile time tests, otherwise we will pay a penalty each time we start up. return hasPurposeSupport() && hasEXIV2DBSupport() && hasGeoMapSupport() && hasVideoThumbnailer() && hasVideoProber(); } struct Data { Data() {} Data(const QString &title, const QString tag, bool featureFound) : title(title) , tag(tag) , featureFound(featureFound) { } QString title; QString tag; bool featureFound; }; QString MainWindow::FeatureDialog::featureString() { QList features; features << Data(i18n("Plug-ins available"), QString::fromLatin1("#purpose"), hasPurposeSupport()); features << Data(i18n("SQLite database support (used for Exif searches)"), QString::fromLatin1("#database"), hasEXIV2DBSupport()); features << Data(i18n("Map view for geotagged images."), QString::fromLatin1("#geomap"), hasGeoMapSupport()); features << Data(i18n("Video support"), QString::fromLatin1("#video"), !supportedVideoMimeTypes().isEmpty()); features << Data(i18n("Video thumbnail support"), QString::fromLatin1("#videoPreview"), hasVideoThumbnailer()); features << Data(i18n("Video metadata support"), QString::fromLatin1("#videoInfo"), hasVideoProber()); QString result = QString::fromLatin1("

    "); const QString red = QString::fromLatin1("%1"); const QString yes = i18nc("Feature available", "Yes"); const QString no = red.arg(i18nc("Feature not available", "No")); const QString formatString = QString::fromLatin1(""); for (QList::ConstIterator featureIt = features.constBegin(); featureIt != features.constEnd(); ++featureIt) { result += formatString .arg((*featureIt).tag) .arg((*featureIt).title) .arg((*featureIt).featureFound ? yes : no); } result += QString::fromLatin1("
    %2%3

    "); return result; } QStringList MainWindow::FeatureDialog::supportedVideoMimeTypes() { return Phonon::BackendCapabilities::availableMimeTypes(); } // vi:expandtab:tabstop=4 shiftwidth=4: